public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/56743] New: Namelist bug with comment and no blank
@ 2013-03-26 16:20 janus at gcc dot gnu.org
  2013-03-26 16:27 ` [Bug fortran/56743] " dominiq at lps dot ens.fr
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: janus at gcc dot gnu.org @ 2013-03-26 16:20 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56743
           Summary: Namelist bug with comment and no blank
    Classification: Unclassified
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: janus@gcc.gnu.org


Reduced test case (inspired by the one in PR 56660), originally reported by Kai
Gallmeister:


integer :: value = 100
namelist /nml/ value

write (*, nml=nml)

open (99, file='nml.dat', status="replace")
write(99,*) "&nml"
write(99,*) "  value=1!11"
write(99,*) "/"

rewind(99)
read (99, nml=nml)
write (*, nml=nml)

close (99, status="delete")

end 



Output with 4.3, 4.7 and trunk (haven't tried other versions):

&NML
 VALUE=        100,
 /
&NML
 VALUE=        100,
 /

Expected output:

&NML
 VALUE=        100,
 /
&NML
 VALUE=          1,
 /


The fact that there is no blank between the number and the comment should not
make any difference, right? Unfortunately it does ...


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

* [Bug fortran/56743] Namelist bug with comment and no blank
  2013-03-26 16:20 [Bug fortran/56743] New: Namelist bug with comment and no blank janus at gcc dot gnu.org
@ 2013-03-26 16:27 ` dominiq at lps dot ens.fr
  2013-03-26 16:58 ` burnus at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-03-26 16:27 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-03-26
     Ever Confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-03-26 16:27:26 UTC ---
Confirmed.


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

* [Bug fortran/56743] Namelist bug with comment and no blank
  2013-03-26 16:20 [Bug fortran/56743] New: Namelist bug with comment and no blank janus at gcc dot gnu.org
  2013-03-26 16:27 ` [Bug fortran/56743] " dominiq at lps dot ens.fr
@ 2013-03-26 16:58 ` burnus at gcc dot gnu.org
  2013-03-30  4:08 ` jvdelisle at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-03-26 16:58 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-03-26 16:57:53 UTC ---
Created attachment 29734
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29734
Draft patch (only for read_integer)

Draft patch - fixes the issue of the test case, but one probably should do an
audit of the whole file (list_read). For instance, using REAL instead of
INTEGER in the test case also fails. One probably does not need to handle all
CASE_SEPARATORS, but presumably a large number of those.


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

* [Bug fortran/56743] Namelist bug with comment and no blank
  2013-03-26 16:20 [Bug fortran/56743] New: Namelist bug with comment and no blank janus at gcc dot gnu.org
  2013-03-26 16:27 ` [Bug fortran/56743] " dominiq at lps dot ens.fr
  2013-03-26 16:58 ` burnus at gcc dot gnu.org
@ 2013-03-30  4:08 ` jvdelisle at gcc dot gnu.org
  2013-03-30 10:47 ` burnus at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2013-03-30  4:08 UTC (permalink / raw)
  To: gcc-bugs


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

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

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

--- Comment #3 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2013-03-30 04:08:19 UTC ---
Agree, we should just audit list_read.c for this case.


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

* [Bug fortran/56743] Namelist bug with comment and no blank
  2013-03-26 16:20 [Bug fortran/56743] New: Namelist bug with comment and no blank janus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-03-30  4:08 ` jvdelisle at gcc dot gnu.org
@ 2013-03-30 10:47 ` burnus at gcc dot gnu.org
  2013-05-03 20:32 ` jvdelisle at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-03-30 10:47 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-03-30 10:47:30 UTC ---
Created attachment 29752
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29752
Test case  - please read comment in the file or comment 4

The test case is successful with ifort 13.1, it fails (iostat/=0, run time
failure) with Crayftn and PGI already for "i=1!".


According to the Fortran standard, the example - as the example in comment 0 -
is invalid. From Fortran 2008, "10.11.3.6 Namelist comments":

"Except within a character literal constant, a "!" character after a value
separator or in the first nonblank position of a namelist input record
initiates a comment."

Note the "after a value separator". In "i=1!" there is no value separator after
the value "1".


For my character example "c1 = a": Also that example is invalid according to
the Fortran standard, which states in "10.11.3.3 Namelist input values":

"When the next effective item is of type character, the input form consists of
a delimited sequence of zero or more rep-chars [...]"

Thus, either " or ' is required as delimiter - but the example doesn't use
neither.



EXPECTED RESULTS:

(a) "i=1!" is either accepted as vendor extension as "i=1 !...", matching
Intel's result.  Or it is rejected with a compile-time error as Crayftn and PGI
do it.

Currently, integers and reals (except for INF/NAN) give not error but the
result is not modified (BUG!).  For logical, complex and delimited character
strings, the value is read (as vendor extension), and for INF and NAN a "cannot
match namelist object" error is shown - which is acceptable according to the
standard an matches PGI/Crayftn.


(b) For nondelimited character strings: Currently, it gives the error "Cannot
match namelist object", which is fine according to the standard. One could
still consider to support reading it as vendor extension - as Intel does.
(Simply read from the first nonspace character to the first value separator.)


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

* [Bug fortran/56743] Namelist bug with comment and no blank
  2013-03-26 16:20 [Bug fortran/56743] New: Namelist bug with comment and no blank janus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-03-30 10:47 ` burnus at gcc dot gnu.org
@ 2013-05-03 20:32 ` jvdelisle at gcc dot gnu.org
  2015-04-07 19:28 ` jvdelisle at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2013-05-03 20:32 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2013-05-03 20:32:51 UTC ---
I have a patch testing that fixes the items identified in the attachment of
Comment #4 by accepting them as extension.


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

* [Bug fortran/56743] Namelist bug with comment and no blank
  2013-03-26 16:20 [Bug fortran/56743] New: Namelist bug with comment and no blank janus at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-05-03 20:32 ` jvdelisle at gcc dot gnu.org
@ 2015-04-07 19:28 ` jvdelisle at gcc dot gnu.org
  2015-04-16  2:23 ` jvdelisle at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2015-04-07 19:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56743

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jvdelisle at gcc dot gnu.org

--- Comment #6 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
I forgot about this one.


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

* [Bug fortran/56743] Namelist bug with comment and no blank
  2013-03-26 16:20 [Bug fortran/56743] New: Namelist bug with comment and no blank janus at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2015-04-07 19:28 ` jvdelisle at gcc dot gnu.org
@ 2015-04-16  2:23 ` jvdelisle at gcc dot gnu.org
  2015-04-21 16:14 ` jvdelisle at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2015-04-16  2:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56743

--- Comment #7 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Potential simple patch.

Index: io/list_read.c
===================================================================
--- io/list_read.c    (revision 222110)
+++ io/list_read.c    (working copy)
@@ -53,7 +53,7 @@ typedef unsigned char uchar;
                       case '5': case '6': case '7': case '8': case '9'

 #define CASE_SEPARATORS  case ' ': case ',': case '/': case '\n': case '\t': \
-                         case '\r': case ';'
+                         case '\r': case ';': case '!'

 /* This macro assumes that we're operating on a variable.  */


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

* [Bug fortran/56743] Namelist bug with comment and no blank
  2013-03-26 16:20 [Bug fortran/56743] New: Namelist bug with comment and no blank janus at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2015-04-16  2:23 ` jvdelisle at gcc dot gnu.org
@ 2015-04-21 16:14 ` jvdelisle at gcc dot gnu.org
  2015-04-21 16:34 ` jvdelisle at gcc dot gnu.org
  2015-04-21 16:42 ` jvdelisle at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2015-04-21 16:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56743

--- Comment #8 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Author: jvdelisle
Date: Tue Apr 21 16:13:54 2015
New Revision: 222271

URL: https://gcc.gnu.org/viewcvs?rev=222271&root=gcc&view=rev
Log:
2015-04-21 Jerry DeLisle  <jvdelisle@gcc.gnu.org>

    PR libgfortran/56743
    * io/list_read.c (CASE_SEPARATORS): Add case for '!'.
    (is_separator): Add condition for '!'.
    (eat_separator): Use notify_std to warn or errord if '!' is
    encountered before a proper separator.

Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/list_read.c


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

* [Bug fortran/56743] Namelist bug with comment and no blank
  2013-03-26 16:20 [Bug fortran/56743] New: Namelist bug with comment and no blank janus at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2015-04-21 16:14 ` jvdelisle at gcc dot gnu.org
@ 2015-04-21 16:34 ` jvdelisle at gcc dot gnu.org
  2015-04-21 16:42 ` jvdelisle at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2015-04-21 16:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56743

--- Comment #9 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Author: jvdelisle
Date: Tue Apr 21 16:33:27 2015
New Revision: 222272

URL: https://gcc.gnu.org/viewcvs?rev=222272&root=gcc&view=rev
Log:
2015-04-21 Jerry DeLisle  <jvdelisle@gcc.gnu.org>

    PR libgfortran/56743
    * gfortran.dg/namelist_87.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/namelist_87.f90
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/56743] Namelist bug with comment and no blank
  2013-03-26 16:20 [Bug fortran/56743] New: Namelist bug with comment and no blank janus at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2015-04-21 16:34 ` jvdelisle at gcc dot gnu.org
@ 2015-04-21 16:42 ` jvdelisle at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2015-04-21 16:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56743

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

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

--- Comment #10 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Fixed on trunk. Closing.


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

end of thread, other threads:[~2015-04-21 16:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-26 16:20 [Bug fortran/56743] New: Namelist bug with comment and no blank janus at gcc dot gnu.org
2013-03-26 16:27 ` [Bug fortran/56743] " dominiq at lps dot ens.fr
2013-03-26 16:58 ` burnus at gcc dot gnu.org
2013-03-30  4:08 ` jvdelisle at gcc dot gnu.org
2013-03-30 10:47 ` burnus at gcc dot gnu.org
2013-05-03 20:32 ` jvdelisle at gcc dot gnu.org
2015-04-07 19:28 ` jvdelisle at gcc dot gnu.org
2015-04-16  2:23 ` jvdelisle at gcc dot gnu.org
2015-04-21 16:14 ` jvdelisle at gcc dot gnu.org
2015-04-21 16:34 ` jvdelisle at gcc dot gnu.org
2015-04-21 16:42 ` jvdelisle at gcc dot gnu.org

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).