public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/56735] New: Namelist Read Error with question marks
@ 2013-03-26 10:08 madawilliams at gmail dot com
  2013-03-26 10:17 ` [Bug fortran/56735] " dominiq at lps dot ens.fr
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: madawilliams at gmail dot com @ 2013-03-26 10:08 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56735

             Bug #: 56735
           Summary: Namelist Read Error with question marks
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: madawilliams@gmail.com


Hi,

This is my first ever bug report so apologies if i miss some vital piece of
information. I have some legacy code which compiles and runs with versions of
gfortran up to 4.5. However after this the code compiles and runs but the
namelist is not read correctly. There is no IO errors but non of the variables
are set to their respective values. I have managed to narrow this down to the
fact that the legacy namelist has question marks in the namelist file outside
of any data block. Below is a very simple code and namelist which shows this.
If you remove the question mark from the name list the values are set,
otherwise they are not.

-test.f
        PROGRAM TEST

        INTEGER int1,int2,int3

        NAMELIST /temp/ int1,int2,int3

        OPEN (53,FILE='test.nam',STATUS='OLD', IOSTAT=istat)
        READ (53,temp)
        WRITE(*, temp)
        PRINT*, istat
        END PROGRAM

-test.nam
  ? 

 $temp
  int1=1
  int2=2
  int3=3
 $END

I understand this might be non standard formatting for the namelist file, but
as I said it works with gfortran <4.6 so seems like a regression.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/56735] Namelist Read Error with question marks
  2013-03-26 10:08 [Bug fortran/56735] New: Namelist Read Error with question marks madawilliams at gmail dot com
@ 2013-03-26 10:17 ` dominiq at lps dot ens.fr
  2013-03-26 10:26 ` madawilliams at gmail dot com
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-03-26 10:17 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56735

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-03-26 10:17:25 UTC ---
It works for me (x86_64-apple-darwin10) from 4.4.6 up to the latest trunk
(197095). On which platform do you see this problem (post the output of
gfortran -v)?


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/56735] Namelist Read Error with question marks
  2013-03-26 10:08 [Bug fortran/56735] New: Namelist Read Error with question marks madawilliams at gmail dot com
  2013-03-26 10:17 ` [Bug fortran/56735] " dominiq at lps dot ens.fr
@ 2013-03-26 10:26 ` madawilliams at gmail dot com
  2013-03-26 10:36 ` dominiq at lps dot ens.fr
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: madawilliams at gmail dot com @ 2013-03-26 10:26 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56735

--- Comment #2 from Adam Williams <madawilliams at gmail dot com> 2013-03-26 10:26:43 UTC ---
Hi Dominique

Cheers for the quick response. Here is my gfortran -v info:

Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/gfortran/libexec/gcc/x86_64-apple-darwin11/4.6.2/lto-wrapper
Target: x86_64-apple-darwin11
Configured with: ../gcc-4.6.2-RC-20111019/configure
--prefix=/usr/local/gfortran --with-gmp=/Users/fx/devel/gcc/deps-static/x86_64
--enable-languages=c,c++,fortran,objc,obj-c++ --build=x86_64-apple-darwin11
Thread model: posix
gcc version 4.6.2 20111019 (prerelease) (GCC) 

With the question mark in the namelist file i get the following output:

&TEMP
 INT1=   17252416,
 INT2=      32767,
 INT3= 1589168960,
 /
           0


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/56735] Namelist Read Error with question marks
  2013-03-26 10:08 [Bug fortran/56735] New: Namelist Read Error with question marks madawilliams at gmail dot com
  2013-03-26 10:17 ` [Bug fortran/56735] " dominiq at lps dot ens.fr
  2013-03-26 10:26 ` madawilliams at gmail dot com
@ 2013-03-26 10:36 ` dominiq at lps dot ens.fr
  2013-03-26 11:47 ` [Bug fortran/56735] [4.6/4.7/4.8/4.9 Regression] " dominiq at lps dot ens.fr
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-03-26 10:36 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56735

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jvdelisle at gcc dot
                   |                            |gnu.org, tiloschwarz at gcc
                   |                            |dot gnu.org

--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-03-26 10:36:13 UTC ---
OK, I did look enough to the output. With 4.6.3, I get

&TEMP
 INT1=       4160,
 INT2=      32767,
 INT3= 1606408400,
 /
           0

and a lot of valgrind errors. With 4.7 up to trunk, I get

&TEMP
 INT1=          0,
 INT2=          0,
 INT3=          0,
 /
           0

and valgrind complains about

==35182== Conditional jump or move depends on uninitialised value(s)
==35182==    at 0x1000ED987: gfc_itoa (in
/opt/gcc/gcc4.9w/lib/libgfortran.3.dylib)
==35182==    by 0x100000EB1: main (in ./a.out)


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/56735] [4.6/4.7/4.8/4.9 Regression] Namelist Read Error with question marks
  2013-03-26 10:08 [Bug fortran/56735] New: Namelist Read Error with question marks madawilliams at gmail dot com
                   ` (2 preceding siblings ...)
  2013-03-26 10:36 ` dominiq at lps dot ens.fr
@ 2013-03-26 11:47 ` dominiq at lps dot ens.fr
  2013-03-26 12:14 ` madawilliams at gmail dot com
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-03-26 11:47 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56735

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-03-26
            Summary|Namelist Read Error with    |[4.6/4.7/4.8/4.9
                   |question marks              |Regression] Namelist Read
                   |                            |Error with question marks
     Ever Confirmed|0                           |1

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-03-26 11:47:25 UTC ---
AFAICT the first (bad) change (i.e., garbage with 4.6) is due to revision
168502 (pr47154). I'll investigate later for the change giving 0.

I think you should clean your namelists to use standard conforming formats.
Nevertheless gfortran should give the correct answer or reject the file.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/56735] [4.6/4.7/4.8/4.9 Regression] Namelist Read Error with question marks
  2013-03-26 10:08 [Bug fortran/56735] New: Namelist Read Error with question marks madawilliams at gmail dot com
                   ` (3 preceding siblings ...)
  2013-03-26 11:47 ` [Bug fortran/56735] [4.6/4.7/4.8/4.9 Regression] " dominiq at lps dot ens.fr
@ 2013-03-26 12:14 ` madawilliams at gmail dot com
  2013-03-28 12:42 ` burnus at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: madawilliams at gmail dot com @ 2013-03-26 12:14 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56735

--- Comment #5 from Adam Williams <madawilliams at gmail dot com> 2013-03-26 12:14:01 UTC ---
Cheers Dominique,

Unfortunately the code in question is ~25years old with an existing user base
and the namelist is used to set a vast number of initial conditions for varying
simulation runs. However, I will definitely suggest that we try move to a
standard conforming namelist.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/56735] [4.6/4.7/4.8/4.9 Regression] Namelist Read Error with question marks
  2013-03-26 10:08 [Bug fortran/56735] New: Namelist Read Error with question marks madawilliams at gmail dot com
                   ` (4 preceding siblings ...)
  2013-03-26 12:14 ` madawilliams at gmail dot com
@ 2013-03-28 12:42 ` burnus at gcc dot gnu.org
  2013-03-29  9:34 ` burnus at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-03-28 12:42 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56735

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|NEW                         |ASSIGNED
                 CC|                            |burnus at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |burnus at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.6.4

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-03-28 12:42:51 UTC ---
See http://gcc.gnu.org/onlinedocs/gfortran/Extensions-to-namelist.html for the
description of the ? and =? extension.

Actually, there are two bugs:

a) With "?", no attempt is made to read the next item. That's a bug due to
Jerry's patch for PR 47154 (http://gcc.gnu.org/r168502). Here, '?' was falling
through to a "goto find_nml_name;" - but no longer after "case EOF:" was added.

b) With "?", there is no output. Seemingly, a regression due to Janne's patch
for PR 25561 (http://gcc.gnu.org/r135373). Here, a "if (!p)" got lost.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/56735] [4.6/4.7/4.8/4.9 Regression] Namelist Read Error with question marks
  2013-03-26 10:08 [Bug fortran/56735] New: Namelist Read Error with question marks madawilliams at gmail dot com
                   ` (5 preceding siblings ...)
  2013-03-28 12:42 ` burnus at gcc dot gnu.org
@ 2013-03-29  9:34 ` burnus at gcc dot gnu.org
  2013-03-30 15:00 ` burnus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-03-29  9:34 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56735

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-03-29 09:34:29 UTC ---
Author: burnus
Date: Fri Mar 29 09:32:57 2013
New Revision: 197228

URL: http://gcc.gnu.org/viewcvs?rev=197228&root=gcc&view=rev
Log:
2013-03-29  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56735
        * io/list_read.c (nml_query): Only abort when
        an error occured.
        (namelist_read): Add goto instead of falling through.

2013-03-29  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56735
        * gfortran.dg/namelist_80.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/namelist_80.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/libgfortran/io/list_read.c


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/56735] [4.6/4.7/4.8/4.9 Regression] Namelist Read Error with question marks
  2013-03-26 10:08 [Bug fortran/56735] New: Namelist Read Error with question marks madawilliams at gmail dot com
                   ` (6 preceding siblings ...)
  2013-03-29  9:34 ` burnus at gcc dot gnu.org
@ 2013-03-30 15:00 ` burnus at gcc dot gnu.org
  2013-04-02 16:31 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-03-30 15:00 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56735

--- Comment #8 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-03-30 15:00:11 UTC ---
The issue has been fixed on the 4.9 development branch - and it is scheduled
for backporting to the 4.6, 4.7 and 4.8 release branches.

See http://gcc.gnu.org/wiki/GFortranBinaries for regular nonofficial builds and
how to build GCC yourself.

(In reply to comment #0)
> -test.nam
>   ? 
> 
>  $temp

The "?" causes the problem. The "?" is rather pointless if the data is read
from a file - and for files read from stdin, it only outputs the available
items in the name list. Thus, a workaround is to either remove the "?" line, to
comment it out, or to change the "?" into "=?".

I don't know whether the workaround helps you - or updating to a fixed GCC
version. But in any case, I want to say sorry for the regression and thanks for
the bug report!


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/56735] [4.6/4.7/4.8/4.9 Regression] Namelist Read Error with question marks
  2013-03-26 10:08 [Bug fortran/56735] New: Namelist Read Error with question marks madawilliams at gmail dot com
                   ` (7 preceding siblings ...)
  2013-03-30 15:00 ` burnus at gcc dot gnu.org
@ 2013-04-02 16:31 ` burnus at gcc dot gnu.org
  2013-04-03  9:53 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-04-02 16:31 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56735

--- Comment #10 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-04-02 16:31:25 UTC ---
Author: burnus
Date: Tue Apr  2 16:30:26 2013
New Revision: 197361

URL: http://gcc.gnu.org/viewcvs?rev=197361&root=gcc&view=rev
Log:
libgfortran/
2013-04-02  Tobias Burnus  <burnus@net-b.de>

        Backport from mainline:
        2013-03-28  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56735
        * io/list_read.c (nml_query): Only abort when
        an error occured.
        (namelist_read): Add goto instead of falling through.


gcc/testsuite/
2013-04-02  Tobias Burnus  <burnus@net-b.de>

        Backport from mainline:
        2013-03-28  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56735
        * gfortran.dg/namelist_80.f90: New.


Added:
    branches/gcc-4_8-branch/gcc/testsuite/gfortran.dg/namelist_80.f90
Modified:
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_8-branch/libgfortran/ChangeLog
    branches/gcc-4_8-branch/libgfortran/io/list_read.c


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/56735] [4.6/4.7/4.8/4.9 Regression] Namelist Read Error with question marks
  2013-03-26 10:08 [Bug fortran/56735] New: Namelist Read Error with question marks madawilliams at gmail dot com
                   ` (8 preceding siblings ...)
  2013-04-02 16:31 ` burnus at gcc dot gnu.org
@ 2013-04-03  9:53 ` burnus at gcc dot gnu.org
  2013-04-04  8:38 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-04-03  9:53 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56735

--- Comment #11 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-04-03 09:53:24 UTC ---
Author: burnus
Date: Wed Apr  3 09:52:06 2013
New Revision: 197396

URL: http://gcc.gnu.org/viewcvs?rev=197396&root=gcc&view=rev
Log:
2013-04-03  Tobias Burnus  <burnus@net-b.de>

        Backport from mainline:
        2013-03-28  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56735
        * io/list_read.c (nml_query): Only abort when
        an error occured.
        (namelist_read): Add goto instead of falling through.

2013-04-03  Tobias Burnus  <burnus@net-b.de>

        Backport from mainline:
        2013-03-28  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56735
        * gfortran.dg/namelist_80.f90: New.


Added:
    branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/namelist_80.f90
Modified:
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_7-branch/libgfortran/ChangeLog
    branches/gcc-4_7-branch/libgfortran/io/list_read.c


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/56735] [4.6/4.7/4.8/4.9 Regression] Namelist Read Error with question marks
  2013-03-26 10:08 [Bug fortran/56735] New: Namelist Read Error with question marks madawilliams at gmail dot com
                   ` (9 preceding siblings ...)
  2013-04-03  9:53 ` burnus at gcc dot gnu.org
@ 2013-04-04  8:38 ` burnus at gcc dot gnu.org
  2013-04-04  8:40 ` burnus at gcc dot gnu.org
  2013-04-04  8:41 ` madawilliams at gmail dot com
  12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-04-04  8:38 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56735

--- Comment #12 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-04-04 08:38:00 UTC ---
2013-04-04  Tobias Burnus  <burnus@net-b.de>

        Backport from mainline:
        2013-03-28  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56735
        * io/list_read.c (nml_query): Only abort when
        an error occured.
        (namelist_read): Add goto instead of falling through.

2013-04-04  Tobias Burnus  <burnus@net-b.de>

        Backport from mainline:
        2013-03-28  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56735
        * gfortran.dg/namelist_80.f90: New.


Added:
    branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/namelist_80.f90
Modified:
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_6-branch/libgfortran/ChangeLog
    branches/gcc-4_6-branch/libgfortran/io/list_read.c


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/56735] [4.6/4.7/4.8/4.9 Regression] Namelist Read Error with question marks
  2013-03-26 10:08 [Bug fortran/56735] New: Namelist Read Error with question marks madawilliams at gmail dot com
                   ` (10 preceding siblings ...)
  2013-04-04  8:38 ` burnus at gcc dot gnu.org
@ 2013-04-04  8:40 ` burnus at gcc dot gnu.org
  2013-04-04  8:41 ` madawilliams at gmail dot com
  12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-04-04  8:40 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56735

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #13 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-04-04 08:40:21 UTC ---
FIXED on the 4.9 trunk - and on the 4.6, 4.7 and 4.8 branches.

The very soon to be released 4.7.3 and 4.6.4 will contain this fix. (As will
4.8.1, but that take still a while.)

Thanks again for the bug report.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug fortran/56735] [4.6/4.7/4.8/4.9 Regression] Namelist Read Error with question marks
  2013-03-26 10:08 [Bug fortran/56735] New: Namelist Read Error with question marks madawilliams at gmail dot com
                   ` (11 preceding siblings ...)
  2013-04-04  8:40 ` burnus at gcc dot gnu.org
@ 2013-04-04  8:41 ` madawilliams at gmail dot com
  12 siblings, 0 replies; 14+ messages in thread
From: madawilliams at gmail dot com @ 2013-04-04  8:41 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56735

--- Comment #14 from Adam Williams <madawilliams at gmail dot com> 2013-04-04 08:41:32 UTC ---
Thanks for all your help


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-04-04  8:41 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-26 10:08 [Bug fortran/56735] New: Namelist Read Error with question marks madawilliams at gmail dot com
2013-03-26 10:17 ` [Bug fortran/56735] " dominiq at lps dot ens.fr
2013-03-26 10:26 ` madawilliams at gmail dot com
2013-03-26 10:36 ` dominiq at lps dot ens.fr
2013-03-26 11:47 ` [Bug fortran/56735] [4.6/4.7/4.8/4.9 Regression] " dominiq at lps dot ens.fr
2013-03-26 12:14 ` madawilliams at gmail dot com
2013-03-28 12:42 ` burnus at gcc dot gnu.org
2013-03-29  9:34 ` burnus at gcc dot gnu.org
2013-03-30 15:00 ` burnus at gcc dot gnu.org
2013-04-02 16:31 ` burnus at gcc dot gnu.org
2013-04-03  9:53 ` burnus at gcc dot gnu.org
2013-04-04  8:38 ` burnus at gcc dot gnu.org
2013-04-04  8:40 ` burnus at gcc dot gnu.org
2013-04-04  8:41 ` madawilliams at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).