bug in namelist read

Harper, Christie harper@huntsville.sparta.com
Thu Nov 30 14:01:00 GMT 2000


we have found a bug with the namelist read of logical variables.

g77 version 2.95.2 19991024 (release)

the problem appears when you read in variables whose name begins
with a "t" or an "f" after you read in the logical variable.
trying the suggested compiler options had no effect.

it ignores the values associated with the "t" or "f" variable name
and sets the logical values to true or false.


this program illustrates the point

      program simerr
      logical tf(5)
      namelist /list/ tf,tt,ff,xyz
      open (unit=1,status='old',name='simerr.inp')
      do i=1,5
         tf(i)=.false.
      enddo
      read(1,list)
      write(6,list)
      stop
      end

input file:

 &list
  tf=.t.,.f.,.t.,
  ff=33.,
  tt=23.0,
  xyz=-1234.55,
 &end

you would expect the output

tf=.t.,.f.,.t.,.f.,.f.,
ff=33.,
tt=23.,
xyz=-1234.55


what you get is:


 TF = T F T F T, 
 TT =  0., 
 FF =  0., 
 XYZ = -1234.55005/



christie harper
SPARTA Inc.
(256) 837-5282 x 1216 


More information about the Gcc-bugs mailing list