This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Namelist having problems with whitespace?


Dear all,

I have just run across what appears to be strange behaviour with namelists. First spotted in a custom build of gcc 4.3.0 and I've just got a reduced test case on my home machine with 4.3.0 20080428 (Red Hat 4.3.0-8)

It came from some legacy Fortran77 code (and I know namelists were not part of that standard!) and used to run with g77 okay.

Apologies if my email distorts the whitespace.

> cat check1.f
      program check1
      real x
      namelist/casein/x
      read(1,casein)
      print*,x
      end

> cat fort.1
&CASEIN	
		x=1.,
/

Note that the whitespace in front of the x consists of 2 tab characters.

This produces as expected:
  1.00000000

Add a single tab to the end of CASEIN and it produces:

At line 4 of file check1.f (unit = 1, file = 'fort.1')
Fortran runtime error: Cannot match namelist object name

Remove one tab from immediately in front of x and it works again.

There are a few other combinations of multiple tabs and spaces I tried but the only one that appeared to work flawlessly was replacing all tabs with spaces.

Any opinions on this?

I can always _try_ and tell users to always untab their input files, but I'm certain there will be several who forget.... (and there are bound to be some who will insist that tabs are 'best' anyway...)
-- 
----------------------------------------------------------
----------------------------------------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]