public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/27138]  New: gfortran: Fails to
@ 2006-04-12 20:24 tobias dot burnus at physik dot fu-berlin dot de
  2006-04-12 20:45 ` [Bug fortran/27138] " tobias dot burnus at physik dot fu-berlin dot de
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: tobias dot burnus at physik dot fu-berlin dot de @ 2006-04-12 20:24 UTC (permalink / raw)
  To: gcc-bugs




-- 
           Summary: gfortran: Fails to
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tobias dot burnus at physik dot fu-berlin dot de


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


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

* [Bug fortran/27138] gfortran: Fails to
  2006-04-12 20:24 [Bug fortran/27138] New: gfortran: Fails to tobias dot burnus at physik dot fu-berlin dot de
@ 2006-04-12 20:45 ` tobias dot burnus at physik dot fu-berlin dot de
  2006-04-12 21:05 ` [Bug fortran/27138] gfortran: read(*,*) myInt advances only one character on error tobias dot burnus at physik dot fu-berlin dot de
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: tobias dot burnus at physik dot fu-berlin dot de @ 2006-04-12 20:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from tobias dot burnus at physik dot fu-berlin dot de  2006-04-12 20:45 -------
Created an attachment (id=11252)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11252&action=view)
test.tar.gz containing inp-test and test.F

This is SUSE's gcc-fortran-4.1.0-15, "Merge[d] up to rev 112748 for gfortran
changes on the branch."

The attached program "test.F" reads an inputfile (also attached), which
contains three lines:
1| igrd=1,lwb=F,ndvgrd=6,idsprs=0,chng=-0.100D-11
2|
3| 12

This file is read by three "READ (5,*,END=<n>,ERR=<n>) ntype" lines. With
Ifort, the first READ has an error and the second read gets the "12".
With gfortran, all three reads get an error.

Expected: Either the second or the third read picks up the 12.

The attached program prints with the Intel Fortran Compiler 9.0.033:
  Second read: ntype =           12
whereas with gfortran it only shows:
  Error glancing  at inp-file


-- 


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


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

* [Bug fortran/27138] gfortran: read(*,*) myInt advances only one character on error
  2006-04-12 20:24 [Bug fortran/27138] New: gfortran: Fails to tobias dot burnus at physik dot fu-berlin dot de
  2006-04-12 20:45 ` [Bug fortran/27138] " tobias dot burnus at physik dot fu-berlin dot de
@ 2006-04-12 21:05 ` tobias dot burnus at physik dot fu-berlin dot de
  2006-04-13  0:22 ` jvdelisle at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: tobias dot burnus at physik dot fu-berlin dot de @ 2006-04-12 21:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from tobias dot burnus at physik dot fu-berlin dot de  2006-04-12 21:05 -------
If one replaces the third read by
  character(len=300) :: str
  READ (5,*,END=100,ERR=99) str
  WRITE(*,*) trim(str)
one sees that the first two failing READs advance by one character each
('i','g').
The third (string) read then reads up to the comma ('td=1')

I would expect (as well as the program writer) that after the failed read one
is still in the next line (as ADVANCE=YES is implied).

Why the read(5,*) str only reads up to the comma and not the whole line, is
also an enigma for me.

G95 (GCC 4.0.3 (g95!) Apr  4 2006,
pgf95 6.0-5
PathScale EKOPath Version 2.1
(and as mentioned) Intel Fortran Compiler 9.0.033
all read the "12" with the second read.


-- 

tobias dot burnus at physik dot fu-berlin dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|gfortran: Fails to          |gfortran: read(*,*) myInt
                   |                            |advances only one character
                   |                            |on error


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


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

* [Bug fortran/27138] gfortran: read(*,*) myInt advances only one character on error
  2006-04-12 20:24 [Bug fortran/27138] New: gfortran: Fails to tobias dot burnus at physik dot fu-berlin dot de
  2006-04-12 20:45 ` [Bug fortran/27138] " tobias dot burnus at physik dot fu-berlin dot de
  2006-04-12 21:05 ` [Bug fortran/27138] gfortran: read(*,*) myInt advances only one character on error tobias dot burnus at physik dot fu-berlin dot de
@ 2006-04-13  0:22 ` jvdelisle at gcc dot gnu dot org
  2006-04-13  4:26 ` jvdelisle at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-04-13  0:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jvdelisle at gcc dot gnu dot org  2006-04-13 00:22 -------
I will investigate.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jvdelisle at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-04-13 00:22:23
               date|                            |


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


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

* [Bug fortran/27138] gfortran: read(*,*) myInt advances only one character on error
  2006-04-12 20:24 [Bug fortran/27138] New: gfortran: Fails to tobias dot burnus at physik dot fu-berlin dot de
                   ` (2 preceding siblings ...)
  2006-04-13  0:22 ` jvdelisle at gcc dot gnu dot org
@ 2006-04-13  4:26 ` jvdelisle at gcc dot gnu dot org
  2006-04-13  7:20 ` jvdelisle at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-04-13  4:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jvdelisle at gcc dot gnu dot org  2006-04-13 04:26 -------
I have looked this over.  Its a matter of what behavior is acceptable for each
type of error we get.  My interpretation of your testcase is that we should do
a next_record when we detect the error before we do the generate_error if we
are in ADVANCE_YES.  So if its an error due to an I/O problem such as hardware
failure we will just fail out like now.  If its a "content of the file" error
we do a next_record before going into th error handling code.  This will
presumably take us past the current line, ready for another read.

I just wonder if this is the universal behavior we should have.  Regardless, I
will see if I can work up a patch and give it a spin.


-- 


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


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

* [Bug fortran/27138] gfortran: read(*,*) myInt advances only one character on error
  2006-04-12 20:24 [Bug fortran/27138] New: gfortran: Fails to tobias dot burnus at physik dot fu-berlin dot de
                   ` (3 preceding siblings ...)
  2006-04-13  4:26 ` jvdelisle at gcc dot gnu dot org
@ 2006-04-13  7:20 ` jvdelisle at gcc dot gnu dot org
  2006-04-14  5:50 ` jvdelisle at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-04-13  7:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jvdelisle at gcc dot gnu dot org  2006-04-13 07:20 -------
The "engima" referred to in comment#2 is because it is a list directed read and
commas and spaces are deliminators.  If you turn this into a read with a format
of '(a)' you get the whole string.

I am still working on the remaining dubious behavior.  :)  


-- 


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


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

* [Bug fortran/27138] gfortran: read(*,*) myInt advances only one character on error
  2006-04-12 20:24 [Bug fortran/27138] New: gfortran: Fails to tobias dot burnus at physik dot fu-berlin dot de
                   ` (4 preceding siblings ...)
  2006-04-13  7:20 ` jvdelisle at gcc dot gnu dot org
@ 2006-04-14  5:50 ` jvdelisle at gcc dot gnu dot org
  2006-04-15  3:00 ` patchapp at dberlin dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-04-14  5:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jvdelisle at gcc dot gnu dot org  2006-04-14 05:50 -------
Created an attachment (id=11263)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11263&action=view)
Proposed Patch

This is a proposed patch you can try out while I work up a more complete test
case.  The example given only addresses an integer read.  The same thing
happens for real, complex, or logical I think.


-- 


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


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

* [Bug fortran/27138] gfortran: read(*,*) myInt advances only one character on error
  2006-04-12 20:24 [Bug fortran/27138] New: gfortran: Fails to tobias dot burnus at physik dot fu-berlin dot de
                   ` (5 preceding siblings ...)
  2006-04-14  5:50 ` jvdelisle at gcc dot gnu dot org
@ 2006-04-15  3:00 ` patchapp at dberlin dot org
  2006-04-17  2:34 ` jvdelisle at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: patchapp at dberlin dot org @ 2006-04-15  3:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from patchapp at dberlin dot org  2006-04-15 03:00 -------
Subject: Bug number PR27138

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-04/msg00547.html


-- 


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


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

* [Bug fortran/27138] gfortran: read(*,*) myInt advances only one character on error
  2006-04-12 20:24 [Bug fortran/27138] New: gfortran: Fails to tobias dot burnus at physik dot fu-berlin dot de
                   ` (6 preceding siblings ...)
  2006-04-15  3:00 ` patchapp at dberlin dot org
@ 2006-04-17  2:34 ` jvdelisle at gcc dot gnu dot org
  2006-04-17  2:37 ` jvdelisle at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-04-17  2:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jvdelisle at gcc dot gnu dot org  2006-04-17 02:33 -------
Subject: Bug 27138

Author: jvdelisle
Date: Mon Apr 17 02:33:51 2006
New Revision: 112999

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112999
Log:
2006-04-14  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/27138
        * io/list_read.c (eat_line): New function.
        (parse_repeat): Use new function and free_saved.
        (read_logical): Same.
        (read_integer): Use new function.
        (parse_real): Use nml_bad_return and new function.
        (read_complex): Use new function and free_saved.
        (read_real): Same.

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


-- 


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


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

* [Bug fortran/27138] gfortran: read(*,*) myInt advances only one character on error
  2006-04-12 20:24 [Bug fortran/27138] New: gfortran: Fails to tobias dot burnus at physik dot fu-berlin dot de
                   ` (7 preceding siblings ...)
  2006-04-17  2:34 ` jvdelisle at gcc dot gnu dot org
@ 2006-04-17  2:37 ` jvdelisle at gcc dot gnu dot org
  2006-04-21  3:47 ` jvdelisle at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-04-17  2:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jvdelisle at gcc dot gnu dot org  2006-04-17 02:37 -------
Subject: Bug 27138

Author: jvdelisle
Date: Mon Apr 17 02:37:15 2006
New Revision: 113000

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113000
Log:
2006-04-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/27138
        * gfortran.dg/read_bad_advance.f90: New test.

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


-- 


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


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

* [Bug fortran/27138] gfortran: read(*,*) myInt advances only one character on error
  2006-04-12 20:24 [Bug fortran/27138] New: gfortran: Fails to tobias dot burnus at physik dot fu-berlin dot de
                   ` (8 preceding siblings ...)
  2006-04-17  2:37 ` jvdelisle at gcc dot gnu dot org
@ 2006-04-21  3:47 ` jvdelisle at gcc dot gnu dot org
  2006-04-21  3:51 ` jvdelisle at gcc dot gnu dot org
  2006-04-21  3:53 ` jvdelisle at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-04-21  3:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jvdelisle at gcc dot gnu dot org  2006-04-21 03:47 -------
Subject: Bug 27138

Author: jvdelisle
Date: Fri Apr 21 03:47:23 2006
New Revision: 113131

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113131
Log:
2006-04-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/27138
        * io/list_read.c (eat_line): New function.
        (parse_repeat): Use new function and free_saved.
        (read_logical): Same.
        (read_integer): Use new function.
        (parse_real): Use nml_bad_return and new function.
        (read_complex): Use new function and free_saved.
        (read_real): Same.

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


-- 


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


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

* [Bug fortran/27138] gfortran: read(*,*) myInt advances only one character on error
  2006-04-12 20:24 [Bug fortran/27138] New: gfortran: Fails to tobias dot burnus at physik dot fu-berlin dot de
                   ` (9 preceding siblings ...)
  2006-04-21  3:47 ` jvdelisle at gcc dot gnu dot org
@ 2006-04-21  3:51 ` jvdelisle at gcc dot gnu dot org
  2006-04-21  3:53 ` jvdelisle at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-04-21  3:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from jvdelisle at gcc dot gnu dot org  2006-04-21 03:51 -------
Subject: Bug 27138

Author: jvdelisle
Date: Fri Apr 21 03:51:44 2006
New Revision: 113132

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113132
Log:
2006-04-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/27138
        * gfortran.dg/read_bad_advance.f90: New test

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


-- 


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


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

* [Bug fortran/27138] gfortran: read(*,*) myInt advances only one character on error
  2006-04-12 20:24 [Bug fortran/27138] New: gfortran: Fails to tobias dot burnus at physik dot fu-berlin dot de
                   ` (10 preceding siblings ...)
  2006-04-21  3:51 ` jvdelisle at gcc dot gnu dot org
@ 2006-04-21  3:53 ` jvdelisle at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-04-21  3:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from jvdelisle at gcc dot gnu dot org  2006-04-21 03:53 -------
Fixed on 4.1 and 4.2.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.1.1


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


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

end of thread, other threads:[~2006-04-21  3:53 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-12 20:24 [Bug fortran/27138] New: gfortran: Fails to tobias dot burnus at physik dot fu-berlin dot de
2006-04-12 20:45 ` [Bug fortran/27138] " tobias dot burnus at physik dot fu-berlin dot de
2006-04-12 21:05 ` [Bug fortran/27138] gfortran: read(*,*) myInt advances only one character on error tobias dot burnus at physik dot fu-berlin dot de
2006-04-13  0:22 ` jvdelisle at gcc dot gnu dot org
2006-04-13  4:26 ` jvdelisle at gcc dot gnu dot org
2006-04-13  7:20 ` jvdelisle at gcc dot gnu dot org
2006-04-14  5:50 ` jvdelisle at gcc dot gnu dot org
2006-04-15  3:00 ` patchapp at dberlin dot org
2006-04-17  2:34 ` jvdelisle at gcc dot gnu dot org
2006-04-17  2:37 ` jvdelisle at gcc dot gnu dot org
2006-04-21  3:47 ` jvdelisle at gcc dot gnu dot org
2006-04-21  3:51 ` jvdelisle at gcc dot gnu dot org
2006-04-21  3:53 ` 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).