Namelist having problems with whitespace?
Steve Edwards
steve.edwards@agustawestland.com
Tue Jun 17 09:48:00 GMT 2008
> Date: Sun, 15 Jun 2008 21:37:56 -0700
> From: Jerry DeLisle <jvdelisle@verizon.net>
> To: Steve Edwards <edwardss@korime.demon.co.uk>
> Cc: fortran@gcc.gnu.org
> Subject: Re: Namelist having problems with whitespace?
>
>
> Steve Edwards wrote:
> > On Fri, 13 Jun 2008 20:54:48 -0700
> > Jerry DeLisle <jvdelisle@verizon.net> wrote:
> >
> >> Jerry DeLisle wrote:
> >>> Steve Edwards wrote:
> >>>> On Sat, 14 Jun 2008 01:52:25 +0100
> >>>> Steve Edwards <edwardss@korime.demon.co.uk> wrote:
> >>>>> 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)
> >>>> My apologies but I should have said what platform that was on:
> >>>>
> >>>> Fedora 9
> >>>> x86_64-unknown-linux-gnu
> >>>>
> >>>> First seen on Fedora 8
> >>>> i686-pc-linux-gnu
> >>>>
> >>>> I can try other platforms if that would be helpful to anyone.
> >>>>
> >>>> Steve E
> >>> I am running the same platform. Thanks for the report. This is
> >>> now PR36538
> >>>
> >>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36538
> >>>
> >>> Jerry
> >>>
> >> Steve,
> >>
> >> In case you are not watching the PR report, here is a patch:
> >>
> >> Index: list_read.c
> >> ===================================================================
> >> --- list_read.c (revision 136763)
> >> +++ list_read.c (working copy)
> >> @@ -2922,6 +2922,8 @@ find_nml_name:
> >> goto find_nml_name;
> >> }
> >>
> >> + eat_separator (dtp);
> >> +
> >> /* Ready to read namelist objects. If there is an error in
> >> input from stdin, output the error message and continue. */
> >>
> >> Regards,
> >>
> >> Jerry
> >
> > Sorry to say it fixed the test case and I then ran in to a similar
> > error. I applied the patch to a freshly download 4.3.1 and then
> > managed to get the following:
> >
> > cat check1.f
> > program check1
> > real a,b,c
> > namelist/CASEDAT/A,B,C
> > read(1,casedat)
> > print*,'a=',a
> > print*,'b=',b
> > print*,'c=',c
> > end
> >
> > cat fort.1
> > &CASEDAT
> > A = 1.0, B = 2.0,
> > C = 3.0,
> > /
> >
> > Again all whitespace being tabs. This time it's the two tabs
> > preceding C that cause the same runtime error:
> >
> > At line 4 of file check1.f (unit = 1, file = 'fort.1')
> > Fortran runtime error: Cannot match namelist object name
> >
> > I checked in the debugger, and it seems to be reading A and B okay.
> >
> > Remove the C line and it works perfectly.
> >
> > I did try to work out what should have been happening, but I'm
> > afraid my C skills aren't up to it!
> >
> > Thanks for all of your help!
> >
> > Steve E
> Thanks for report, obviously we don't use tabs very much :)
>
> Try this patch please.
>
> Regards,
>
> Jerry
>
> Index: list_read.c
> ===================================================================
> --- list_read.c (revision 136821)
> +++ list_read.c (working copy)
> @@ -366,7 +366,7 @@ eat_separator (st_parameter_dt *dtp)
> }
> }
> }
> - while (c == '\n' || c == '\r' || c == ' ');
> + while (c == '\n' || c == '\r' || c == ' ' || c == '\t');
> unget_char (dtp, c);
> }
> break;
Sorry it took me so long to reply, but I've rebuilt,
re-checked, re-installed and it's now working perfectly!
Many thanks for your help on this one.
I don't use tabs much either ;) I only found this when doing some
pre-porting testing of other peoples code with gfortran.
Steve E
--
----------------------------------------------------------
----------------------------------------------------------
More information about the Fortran
mailing list