public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47667] New: I/O for reals: READ waits for input after "i" and "n"
@ 2011-02-09 17:20 burnus at gcc dot gnu.org
  2011-02-09 18:06 ` [Bug fortran/47667] " burnus at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-02-09 17:20 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: I/O for reals: READ waits for input after "i" and "n"
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: jvdelisle@gcc.gnu.org


Based on
https://www.jiscmail.ac.uk/cgi-bin/webadmin?A1=ind1102&L=COMP-FORTRAN-90#2

If one uses:
  READ (*,*) real_variable
and enters "i"<enter> or "n"<enter>, gfortran does not immediately return with
an error but waits for further input. As it does not accept "N"<enter>"aN" but
only "NaN" and "Inf"/"Infinity" as input, this behaviour does not not make
sense.

For other characters, e.g. "e" or "d" it immediately returns with an error.

Expected: As NAG, ifort, pathf95 do (for the linked test case):

  -9.9900000E+02
 Input new value:
i
  ioerr =  140         a =   -9.9900000E+02


Result with gfortran (note extra input line):

  -999.00000
 Input new value:
i

  ioerr =         5010         a =   -999.00000
 Input new value:
i
nf
  ioerr =         5010         a =   -999.00000


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

* [Bug fortran/47667] I/O for reals: READ waits for input after "i" and "n"
  2011-02-09 17:20 [Bug fortran/47667] New: I/O for reals: READ waits for input after "i" and "n" burnus at gcc dot gnu.org
@ 2011-02-09 18:06 ` burnus at gcc dot gnu.org
  2011-02-10  4:23 ` jvdelisle at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-02-09 18:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-02-09 18:03:08 UTC ---
Other input which is handled specially is:

 Input new value:
.e
3
  ioerr =         5010         a =   -999.00000


Interestingly the following works:

 Input new value:
.e4
  ioerr =            0         a =    0.0000000

 Input new value:
.
  ioerr =            0         a =    0.0000000


while ifort and NAG show an error for that input. (g95 has the same result as
gfortran.)


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

* [Bug fortran/47667] I/O for reals: READ waits for input after "i" and "n"
  2011-02-09 17:20 [Bug fortran/47667] New: I/O for reals: READ waits for input after "i" and "n" burnus at gcc dot gnu.org
  2011-02-09 18:06 ` [Bug fortran/47667] " burnus at gcc dot gnu.org
@ 2011-02-10  4:23 ` jvdelisle at gcc dot gnu.org
  2011-02-10 19:31 ` jvdelisle at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-02-10  4:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011.02.10 03:37:59
         AssignedTo|unassigned at gcc dot       |jvdelisle at gcc dot
                   |gnu.org                     |gnu.org
     Ever Confirmed|0                           |1

--- Comment #2 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-02-10 03:37:59 UTC ---
I am working it.


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

* [Bug fortran/47667] I/O for reals: READ waits for input after "i" and "n"
  2011-02-09 17:20 [Bug fortran/47667] New: I/O for reals: READ waits for input after "i" and "n" burnus at gcc dot gnu.org
  2011-02-09 18:06 ` [Bug fortran/47667] " burnus at gcc dot gnu.org
  2011-02-10  4:23 ` jvdelisle at gcc dot gnu.org
@ 2011-02-10 19:31 ` jvdelisle at gcc dot gnu.org
  2011-02-11  6:50 ` jvdelisle at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-02-10 19:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-02-10 19:27:56 UTC ---
The problem is straight forward.  We are pending on IO inside a condition
expressiom.  I will restucture the code to avoid this.


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

* [Bug fortran/47667] I/O for reals: READ waits for input after "i" and "n"
  2011-02-09 17:20 [Bug fortran/47667] New: I/O for reals: READ waits for input after "i" and "n" burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-02-10 19:31 ` jvdelisle at gcc dot gnu.org
@ 2011-02-11  6:50 ` jvdelisle at gcc dot gnu.org
  2011-02-17 19:32 ` jvdelisle at gcc dot gnu.org
  2011-02-17 19:42 ` jvdelisle at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-02-11  6:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-02-11 06:20:15 UTC ---
Probable patch:

Index: list_read.c
===================================================================
--- list_read.c    (revision 170042)
+++ list_read.c    (working copy)
@@ -1726,8 +1726,9 @@ read_real (st_parameter_dt *dtp, void * dest, int
       hit_eof (dtp);
       return;
     }
-  else
+  else if (c != '\n')
     eat_line (dtp);
+
   sprintf (message, "Bad real number in item %d of list input",
           dtp->u.p.item_count);
   generate_error (&dtp->common, LIBERROR_READ_VALUE, message);

Regression testing now.


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

* [Bug fortran/47667] I/O for reals: READ waits for input after "i" and "n"
  2011-02-09 17:20 [Bug fortran/47667] New: I/O for reals: READ waits for input after "i" and "n" burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-02-11  6:50 ` jvdelisle at gcc dot gnu.org
@ 2011-02-17 19:32 ` jvdelisle at gcc dot gnu.org
  2011-02-17 19:42 ` jvdelisle at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-02-17 19:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-02-17 19:28:53 UTC ---
Manually pasted here, typo on PR number.

Author: jvdelisle
Date: Thu Feb 17 05:19:50 2011
New Revision: 170239

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

    PR libgfortran/47667
    * io/list_read.c (read_logical): Check for end of line before calling
    eat_line. (read_integer): Likewise. (parse_real): Don't unget the
    separator. Check for end of line before calling    eat_line.
    (read_complex): Allow line-end before and after parenthesis and comma.
    Check for end of line before calling eat_line. (read_real): Check for
    end of line before calling eat_line.

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


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

* [Bug fortran/47667] I/O for reals: READ waits for input after "i" and "n"
  2011-02-09 17:20 [Bug fortran/47667] New: I/O for reals: READ waits for input after "i" and "n" burnus at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-02-17 19:32 ` jvdelisle at gcc dot gnu.org
@ 2011-02-17 19:42 ` jvdelisle at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-02-17 19:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-02-17 19:31:58 UTC ---
Closing,


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

end of thread, other threads:[~2011-02-17 19:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-09 17:20 [Bug fortran/47667] New: I/O for reals: READ waits for input after "i" and "n" burnus at gcc dot gnu.org
2011-02-09 18:06 ` [Bug fortran/47667] " burnus at gcc dot gnu.org
2011-02-10  4:23 ` jvdelisle at gcc dot gnu.org
2011-02-10 19:31 ` jvdelisle at gcc dot gnu.org
2011-02-11  6:50 ` jvdelisle at gcc dot gnu.org
2011-02-17 19:32 ` jvdelisle at gcc dot gnu.org
2011-02-17 19: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).