public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30435]  New: Slash at end of input not recognized according to standard
@ 2007-01-11 12:36 drewmccormack at mac dot com
  2007-01-11 17:00 ` [Bug fortran/30435] " kargl at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: drewmccormack at mac dot com @ 2007-01-11 12:36 UTC (permalink / raw)
  To: gcc-bugs

The Fortran standard states that when you have list directed input, and a
forward slash (/) appears at the end of a line of input, that any variables in
the read statement that have not been initialized should simply be skipped over
(ignored). 

When gfortran encounters a slash at the beginning of a line, it does not
exhibit the correct behavior. For example, this data:

6.34 1.34 4345.34534
/

with this read statement

read(50, *)r1,r2,r3,r4

should set r1 to 6.34, r2 to 1.34, r3 to 4345.34534, and leave r4 unchanged.
But gfortran code issues the following run time error:

Fortran runtime error: Bad real number in item 4 of list input

All other fortran compilers that I use (xlf, ifort, etc) handle this case
correctly.


-- 
           Summary: Slash at end of input not recognized according to
                    standard
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: drewmccormack at mac dot com
 GCC build triplet: Configured with: ../gcc-4.3-20061223/configure --enable-
                    language
  GCC host triplet: gcc version 4.3.0 20061223 (experimental)
GCC target triplet: Target: powerpc-apple-darwin8.8.0


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


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

* [Bug fortran/30435] Slash at end of input not recognized according to standard
  2007-01-11 12:36 [Bug fortran/30435] New: Slash at end of input not recognized according to standard drewmccormack at mac dot com
@ 2007-01-11 17:00 ` kargl at gcc dot gnu dot org
  2007-01-11 17:02 ` kargl at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kargl at gcc dot gnu dot org @ 2007-01-11 17:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from kargl at gcc dot gnu dot org  2007-01-11 17:00 -------
The relevant section of the F2003 standard is 10.9.1.1.
It appears that in list-directed input that if we advance
to a newline during the read and the first item hit is a
/ when get it wrong.  Here a test program.


program t
  integer a, b, c, d

  ! This works as expected
  open(unit=10, file='tmp.dat')
  write(10,*) '1 2 3 / 4'
  rewind(10)
  a = -1; b = -1; c = -1; d = -1;
  read(10,*) a,b,c,d
  print *, a,b,c,d

  ! This works as expected
  rewind(10)
  write(10,*) '1 2 3 /'
  rewind(10)
  a = -2; b = -2; c = -2; d = -2;
  read(10,*) a,b,c,d
  print *, a,b,c,d

  ! This works as expected.
  rewind(10)
  write(10,*) '1 2'
  write(10,*) '3 /'
  rewind(10)
  a = -3; b = -3; c = -3; d = -3;
  read(10,*) a,b,c,d
  print *, a,b,c,d

  ! This fails as reported.
  rewind(10)
  write(10,*) '1 2 3'
  write(10,*) '/'
  rewind(10)
  a = -4; b = -4; c = -4; d = -4;
  read(10,*) a,b,c,d
  print *, a,b,c,d

  close(unit=10, status='delete')
end program t


-- 


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


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

* [Bug fortran/30435] Slash at end of input not recognized according to standard
  2007-01-11 12:36 [Bug fortran/30435] New: Slash at end of input not recognized according to standard drewmccormack at mac dot com
  2007-01-11 17:00 ` [Bug fortran/30435] " kargl at gcc dot gnu dot org
@ 2007-01-11 17:02 ` kargl at gcc dot gnu dot org
  2007-01-12  0:57 ` jvdelisle at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kargl at gcc dot gnu dot org @ 2007-01-11 17:02 UTC (permalink / raw)
  To: gcc-bugs



-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-01-11 17:01:51
               date|                            |


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


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

* [Bug fortran/30435] Slash at end of input not recognized according to standard
  2007-01-11 12:36 [Bug fortran/30435] New: Slash at end of input not recognized according to standard drewmccormack at mac dot com
  2007-01-11 17:00 ` [Bug fortran/30435] " kargl at gcc dot gnu dot org
  2007-01-11 17:02 ` kargl at gcc dot gnu dot org
@ 2007-01-12  0:57 ` jvdelisle at gcc dot gnu dot org
  2007-01-12 23:10 ` jvdelisle at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-01-12  0:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jvdelisle at gcc dot gnu dot org  2007-01-12 00:57 -------
I think I was the last to touch on this section of code so I will take a look
and see if I can fix it.


-- 


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


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

* [Bug fortran/30435] Slash at end of input not recognized according to standard
  2007-01-11 12:36 [Bug fortran/30435] New: Slash at end of input not recognized according to standard drewmccormack at mac dot com
                   ` (2 preceding siblings ...)
  2007-01-12  0:57 ` jvdelisle at gcc dot gnu dot org
@ 2007-01-12 23:10 ` jvdelisle at gcc dot gnu dot org
  2007-01-12 23:36 ` jvdelisle at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-01-12 23:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jvdelisle at gcc dot gnu dot org  2007-01-12 23:10 -------
Subject: Bug 30435

Author: jvdelisle
Date: Fri Jan 12 23:10:27 2007
New Revision: 120737

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120737
Log:
2007-01-12  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/30435
        * io/list_read.c (finish_separator): Don't call next_record.
        (list_formatted_read_scalar): Clean up some comments and whitespace.
        (nml_read_obj): Whitespace fix.

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


-- 


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


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

* [Bug fortran/30435] Slash at end of input not recognized according to standard
  2007-01-11 12:36 [Bug fortran/30435] New: Slash at end of input not recognized according to standard drewmccormack at mac dot com
                   ` (3 preceding siblings ...)
  2007-01-12 23:10 ` jvdelisle at gcc dot gnu dot org
@ 2007-01-12 23:36 ` jvdelisle at gcc dot gnu dot org
  2007-01-13 19:09 ` jvdelisle at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-01-12 23:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jvdelisle at gcc dot gnu dot org  2007-01-12 23:36 -------
Subject: Bug 30435

Author: jvdelisle
Date: Fri Jan 12 23:36:25 2007
New Revision: 120738

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120738
Log:
2007-01-12  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/30435
        * gfortran.dg/list_read_6.f90: New test.

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


-- 


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


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

* [Bug fortran/30435] Slash at end of input not recognized according to standard
  2007-01-11 12:36 [Bug fortran/30435] New: Slash at end of input not recognized according to standard drewmccormack at mac dot com
                   ` (4 preceding siblings ...)
  2007-01-12 23:36 ` jvdelisle at gcc dot gnu dot org
@ 2007-01-13 19:09 ` jvdelisle at gcc dot gnu dot org
  2007-01-13 19:11 ` jvdelisle at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-01-13 19:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jvdelisle at gcc dot gnu dot org  2007-01-13 19:08 -------
Subject: Bug 30435

Author: jvdelisle
Date: Sat Jan 13 19:08:40 2007
New Revision: 120755

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120755
Log:
2007-01-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/30435
        * io/list_read.c (finish_separator): Don't call next_record.
        (list_formatted_read_scalar): Clean up some comments and whitespace.
        (nml_read_obj): Whitespace fix.

Modified:
    branches/gcc-4_2-branch/libgfortran/ChangeLog
    branches/gcc-4_2-branch/libgfortran/io/list_read.c


-- 


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


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

* [Bug fortran/30435] Slash at end of input not recognized according to standard
  2007-01-11 12:36 [Bug fortran/30435] New: Slash at end of input not recognized according to standard drewmccormack at mac dot com
                   ` (5 preceding siblings ...)
  2007-01-13 19:09 ` jvdelisle at gcc dot gnu dot org
@ 2007-01-13 19:11 ` jvdelisle at gcc dot gnu dot org
  2007-01-13 21:00 ` jvdelisle at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-01-13 19:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jvdelisle at gcc dot gnu dot org  2007-01-13 19:11 -------
Subject: Bug 30435

Author: jvdelisle
Date: Sat Jan 13 19:11:02 2007
New Revision: 120756

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120756
Log:
2007-01-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/30435
        * gfortran.dg/list_read_6.f90: New test.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/list_read_6.f90
Modified:
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/30435] Slash at end of input not recognized according to standard
  2007-01-11 12:36 [Bug fortran/30435] New: Slash at end of input not recognized according to standard drewmccormack at mac dot com
                   ` (6 preceding siblings ...)
  2007-01-13 19:11 ` jvdelisle at gcc dot gnu dot org
@ 2007-01-13 21:00 ` jvdelisle at gcc dot gnu dot org
  2007-01-13 21:03 ` jvdelisle at gcc dot gnu dot org
  2007-01-13 21:05 ` jvdelisle at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-01-13 21:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jvdelisle at gcc dot gnu dot org  2007-01-13 21:00 -------
Subject: Bug 30435

Author: jvdelisle
Date: Sat Jan 13 21:00:31 2007
New Revision: 120758

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120758
Log:
2007-01-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/30435
        * io/list_read.c (finish_separator): Don't call next_record.
        (list_formatted_read_scalar): Clean up some comments and whitespace.
        (nml_read_obj): Whitespace fix.

Modified:
    branches/gcc-4_1-branch/libgfortran/ChangeLog
    branches/gcc-4_1-branch/libgfortran/io/list_read.c


-- 


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


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

* [Bug fortran/30435] Slash at end of input not recognized according to standard
  2007-01-11 12:36 [Bug fortran/30435] New: Slash at end of input not recognized according to standard drewmccormack at mac dot com
                   ` (7 preceding siblings ...)
  2007-01-13 21:00 ` jvdelisle at gcc dot gnu dot org
@ 2007-01-13 21:03 ` jvdelisle at gcc dot gnu dot org
  2007-01-13 21:05 ` jvdelisle at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-01-13 21:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jvdelisle at gcc dot gnu dot org  2007-01-13 21:03 -------
Subject: Bug 30435

Author: jvdelisle
Date: Sat Jan 13 21:03:17 2007
New Revision: 120759

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120759
Log:
2007-01-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/30435
        * gfortran.dg/list_read_6.f90: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/list_read_6.f90
Modified:
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/30435] Slash at end of input not recognized according to standard
  2007-01-11 12:36 [Bug fortran/30435] New: Slash at end of input not recognized according to standard drewmccormack at mac dot com
                   ` (8 preceding siblings ...)
  2007-01-13 21:03 ` jvdelisle at gcc dot gnu dot org
@ 2007-01-13 21:05 ` jvdelisle at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-01-13 21:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jvdelisle at gcc dot gnu dot org  2007-01-13 21:05 -------
Fixed on 4.1, 4.2, and 4.3

Drew, thanks for reporting this bug.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.1.3


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


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

end of thread, other threads:[~2007-01-13 21:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-11 12:36 [Bug fortran/30435] New: Slash at end of input not recognized according to standard drewmccormack at mac dot com
2007-01-11 17:00 ` [Bug fortran/30435] " kargl at gcc dot gnu dot org
2007-01-11 17:02 ` kargl at gcc dot gnu dot org
2007-01-12  0:57 ` jvdelisle at gcc dot gnu dot org
2007-01-12 23:10 ` jvdelisle at gcc dot gnu dot org
2007-01-12 23:36 ` jvdelisle at gcc dot gnu dot org
2007-01-13 19:09 ` jvdelisle at gcc dot gnu dot org
2007-01-13 19:11 ` jvdelisle at gcc dot gnu dot org
2007-01-13 21:00 ` jvdelisle at gcc dot gnu dot org
2007-01-13 21:03 ` jvdelisle at gcc dot gnu dot org
2007-01-13 21:05 ` jvdelisle at gcc dot gnu dot 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).