SCIENTIFIC-LINUX-USERS Archives

September 2007

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Hendrik van Hees <[log in to unmask]>
Reply To:
Hendrik van Hees <[log in to unmask]>
Date:
Wed, 19 Sep 2007 10:25:55 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (103 lines)
Thank you very much for all the responses. I think I didn't make the 
problem clear. With the older version of gcc (I am using the fortran 
compiler, g77)

gcc version 3.3.5 20050117 (prerelease) (SUSE Linux)

the little code runs fine.

With the newer version, which is definitely in my installation of SL 5 
(I use yum as a package manager),

gcc version 3.4.6 20060404 (Red Hat 3.4.6-4)

the same code does not work any more. Perhaps it helps, when I give the 
relevant piece of code:

cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

      open(unit=1,
     $     file='RW-total-tadmix4pi-6pi-DY.dat')

      do x=0.2d0,1.45d0,0.01d0
         erg=ipol(x1,set1,x)+ipol(x2,set2,x)+ipol(x3,set3,x)
     $        +ipol(x4,set4,x)+ipol(x5,set5,x)
         write(unit=1,fmt='(2g25.8e3)') 
     $        x,erg
      end do
      
      close(unit=1)
      
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c     add omega and phi (all pT)
      open (unit=2, file='RW-total-tadmix4pi-6pi-DY.dat',
     $     status='old')
      do j=1,nmax1
         read(unit=2,fmt='(2g25.8e3)') x1(j),set1(j)
c         write(*,*) x1(j),set1(j)
      end do
      close(unit=2)
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

As you see. It simply writes some columns of double precision, and in 
the next step it reads the same in again.

Thanks again for all your answers!

Cheers,
Hendrik.

On Wed September 19 2007 02:23, you wrote:
> On 18/09/07 23:19, Hendrik van Hees wrote:
> ..
>
> > In 99.9% of all cases there is no problem with my (rather simple)
> > codes. I can compile them without trouble. Only when I do some
> > (either very simple) I/O, an incompatibility occurs. It happens if
> > I write to a file and then read in the same file again within the
> > same program. This worked without trouble in the older gcc version,
> > but creates weird run-time errors in the new version:
> >
> > invalid number: incomprehensible list input
> > apparent state: unit 1 named RW-total-tadmix4pi-6pi-om-phi-DY.dat
> > last format: list io
> > lately reading sequential formatted external IO
> > Aborted
> >
> > Here, "RW-total-tadmix4pi-6pi-om-phi-DY.dat" is the file I write to
> > disk and then read it in again.
> >
> > Of course it's not a big deal to rewrite the code that this is
> > re-reading not necessary. But, if someone knows a compiler switch
> > or the like so that the writing out and reading in of a file in the
> > same program works again, it would save me some time.
>
> Such basic functionality shouldn't be broken between minor releases,
> if your program is correct (re-reading may depend on the language,
> you may need to clear C++ EOF conditions and such).
>
> The error message you give does not indicate what is wrong (your
> program complains about not being able to parse something it has
> supposedly read from the file - but the read could have failed, or
> you are reading from a different position than expected, or you
> corrupted the data already on write, etc). Which means you probably
> have to spend some time figuring out what exactly is broken with your
> data file (and hence with your program). There is a small chance that
> you have hit some compiler optimization issue (that e.g. affects
> memory layout), I'd recommend to switch off compiler optimization for
> such tests (-O0).
>
> You could also check the changelog, both from upstream gcc
> http://gcc.gnu.org/news.html (each release should have a list of
> changes and "bugs fixed"), and the respective patches from SuSE and
> Red Hat on top of these releases ("rpm -q --changelog gcc").
>
> Hope this helps
> Jan

-- 
Hendrik van Hees 			Texas A&M University 
Phone: 	+1 979/845-1411 		Cyclotron Institute, MS-3366
Fax:	+1 979/845-1899 		College Station, TX 77843-3366
http://cyclotron.tamu.edu/hees/		mailto:[log in to unmask]	

ATOM RSS1 RSS2