public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/14942] New: Incorrect results with implied-do loops and list directed I/O
@ 2004-04-13 19:51 gcc-bugzilla at gcc dot gnu dot org
  2004-04-13 20:08 ` [Bug fortran/14942] [gfortran] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-04-13 19:51 UTC (permalink / raw)
  To: gcc-bugs

	
The use of list directed I/O and implied-do loops gives incorrect
results.  Consider the program: 

      program d
      implicit none
      integer i, j, m, n, nin
      real x(3,4)
      nin = 1
      open(unit = nin, file = 'd.dat')
      read(nin, fmt = *) n
      write(*,'(A,I2)') 'n = ', n
      do i = 1, 3
         read(nin, fmt = *) (x(i,j), j=1, n)
         write(*, *) (x(i,j), j=1, n)
      end do
      read(nin, fmt = *) m, n
      write(*,'(A,I2,2X,A,I2)') 'm = ', m, 'n = ', n
      do i = 1, m
         read(nin, fmt = *) (x(i,j), j=1, n)
         write(*, *) (x(i,j), j=1, n)
      end do
      end program d

G77 produces the following output

kargl[234] ./d
n =  4
  1.  2.  3.  4.
  1.  2.  3.  4.
  1.  2.  3.  4.
m =  3  n =  4
  1.  2.  3.  4.
  1.  2.  3.  4.
  1.  2.  3.  4.

while gfortran produces

kargl[236] ./d
n =  4
   1.000000        0.000000        2.000000       3.9933076E-34    
   1.000000        0.000000        2.000000       6.1756624E-41    
   1.000000        0.000000        2.000000       4.0700904E-34    
m =  1  n =  3
   1.000000        0.000000        2.000000

Environment:
System: FreeBSD c-67-168-59-70.client.comcast.net 5.2-CURRENT FreeBSD 5.2-CURRENT #3: Sun Mar 28 10:41:35 PST 2004 kargl@c-67-168-59-70.client.comcast.net:/usr/obj/usr/src/sys/HOTRATS i386


	
host: i386-unknown-freebsd5.2
build: i386-unknown-freebsd5.2
target: i386-unknown-freebsd5.2
configured with: ../gcc/configure --prefix=/home/kargl/gcc-ssa/work --disable-libmudflap --enable-languages=c,f95 --with-gmp=/usr/local

How-To-Repeat:

Compile the above program and run.
------- Additional Comments From kargl at c-67-168-59-70 dot client dot comcast dot net  2004-04-13 19:01 -------
Fix:
  An unrealistic workaround is the avoidance of the Fortran construct.

-- 
           Summary: Incorrect results with implied-do loops and list
                    directed I/O
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kargl at c-67-168-59-70 dot client dot comcast dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-unknown-freebsd5.2
  GCC host triplet: i386-unknown-freebsd5.2
GCC target triplet: i386-unknown-freebsd5.2


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


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

* [Bug fortran/14942] [gfortran] Incorrect results with implied-do loops and list directed I/O
  2004-04-13 19:51 [Bug fortran/14942] New: Incorrect results with implied-do loops and list directed I/O gcc-bugzilla at gcc dot gnu dot org
@ 2004-04-13 20:08 ` pinskia at gcc dot gnu dot org
  2004-04-13 20:08 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-13 20:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-13 19:48 -------
Confirmed, I could figure out if it is a bug in the front-end or the library.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-04-13 19:48:19
               date|                            |
            Summary|Incorrect results with      |[gfortran] Incorrect results
                   |implied-do loops and list   |with implied-do loops and
                   |directed I/O                |list directed I/O
   Target Milestone|---                         |tree-ssa
            Version|unknown                     |tree-ssa


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


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

* [Bug fortran/14942] [gfortran] Incorrect results with implied-do loops and list directed I/O
  2004-04-13 19:51 [Bug fortran/14942] New: Incorrect results with implied-do loops and list directed I/O gcc-bugzilla at gcc dot gnu dot org
  2004-04-13 20:08 ` [Bug fortran/14942] [gfortran] " pinskia at gcc dot gnu dot org
@ 2004-04-13 20:08 ` pinskia at gcc dot gnu dot org
  2004-04-14  1:31 ` bdavis9659 at comcast dot net
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-13 20:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-13 19:48 -------
Note the data file is:
    4 
    1 2 3 4 
    1 2 3 4 
    1 2 3 4 

    3   4
    1 2 3 4 
    1 2 3 4 
    1 2 3 4 

-- 


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


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

* [Bug fortran/14942] [gfortran] Incorrect results with implied-do loops and list directed I/O
  2004-04-13 19:51 [Bug fortran/14942] New: Incorrect results with implied-do loops and list directed I/O gcc-bugzilla at gcc dot gnu dot org
  2004-04-13 20:08 ` [Bug fortran/14942] [gfortran] " pinskia at gcc dot gnu dot org
  2004-04-13 20:08 ` pinskia at gcc dot gnu dot org
@ 2004-04-14  1:31 ` bdavis9659 at comcast dot net
  2004-04-16  7:46 ` [Bug libfortran/14942] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bdavis9659 at comcast dot net @ 2004-04-14  1:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bdavis9659 at comcast dot net  2004-04-14 00:17 -------
it's in the library.  list_read is bailing out on every other data item.

-- 


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


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

* [Bug libfortran/14942] [gfortran] Incorrect results with implied-do loops and list directed I/O
  2004-04-13 19:51 [Bug fortran/14942] New: Incorrect results with implied-do loops and list directed I/O gcc-bugzilla at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-04-14  1:31 ` bdavis9659 at comcast dot net
@ 2004-04-16  7:46 ` pinskia at gcc dot gnu dot org
  2004-04-16  7:53 ` bdavis9659 at comcast dot net
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-16  7:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-16 02:21 -------
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00946.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug libfortran/14942] [gfortran] Incorrect results with implied-do loops and list directed I/O
  2004-04-13 19:51 [Bug fortran/14942] New: Incorrect results with implied-do loops and list directed I/O gcc-bugzilla at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-04-16  7:46 ` [Bug libfortran/14942] " pinskia at gcc dot gnu dot org
@ 2004-04-16  7:53 ` bdavis9659 at comcast dot net
  2004-04-25  6:42 ` bdavis9659 at comcast dot net
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bdavis9659 at comcast dot net @ 2004-04-16  7:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bdavis9659 at comcast dot net  2004-04-16 02:25 -------
proposed patch:

http://gcc.gnu.org/ml/fortran/2004-04/msg00107.html

-- 


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


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

* [Bug libfortran/14942] [gfortran] Incorrect results with implied-do loops and list directed I/O
  2004-04-13 19:51 [Bug fortran/14942] New: Incorrect results with implied-do loops and list directed I/O gcc-bugzilla at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-04-16  7:53 ` bdavis9659 at comcast dot net
@ 2004-04-25  6:42 ` bdavis9659 at comcast dot net
  2004-04-25 13:35 ` cvs-commit at gcc dot gnu dot org
  2004-04-25 13:38 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: bdavis9659 at comcast dot net @ 2004-04-25  6:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bdavis9659 at comcast dot net  2004-04-25 02:11 -------
re-patch :)
http://gcc.gnu.org/ml/gcc-patches/2004-04/msg01667.html


-- 


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


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

* [Bug libfortran/14942] [gfortran] Incorrect results with implied-do loops and list directed I/O
  2004-04-13 19:51 [Bug fortran/14942] New: Incorrect results with implied-do loops and list directed I/O gcc-bugzilla at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-04-25  6:42 ` bdavis9659 at comcast dot net
@ 2004-04-25 13:35 ` cvs-commit at gcc dot gnu dot org
  2004-04-25 13:38 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-04-25 13:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-04-25 13:07 -------
Subject: Bug 14942

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	tree-ssa-20020619-branch
Changes by:	bdavis@gcc.gnu.org	2004-04-25 13:07:12

Modified files:
	gcc/testsuite  : ChangeLog.tree-ssa 
	libgfortran    : ChangeLog 
	libgfortran/io : list_read.c 
Added files:
	gcc/testsuite/gfortran.fortran-torture/execute: list_read_1.f90 

Log message:
	PR fortran/14942
	* gfortran.fortran-torture/execute/list_read_1.f90: Add new test.
	
	* io/list_read.c(list_formatted_read): finish consuming the
	spaces and seperators at eoln to get ready for next item.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.tree-ssa.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.229&r2=1.1.2.230
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.fortran-torture/execute/list_read_1.f90.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.46&r2=1.1.2.47
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/list_read.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.7&r2=1.1.2.8



-- 


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


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

* [Bug libfortran/14942] [gfortran] Incorrect results with implied-do loops and list directed I/O
  2004-04-13 19:51 [Bug fortran/14942] New: Incorrect results with implied-do loops and list directed I/O gcc-bugzilla at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2004-04-25 13:35 ` cvs-commit at gcc dot gnu dot org
@ 2004-04-25 13:38 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-25 13:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-25 13:30 -------
Fixed.

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


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


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

end of thread, other threads:[~2004-04-25 13:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-13 19:51 [Bug fortran/14942] New: Incorrect results with implied-do loops and list directed I/O gcc-bugzilla at gcc dot gnu dot org
2004-04-13 20:08 ` [Bug fortran/14942] [gfortran] " pinskia at gcc dot gnu dot org
2004-04-13 20:08 ` pinskia at gcc dot gnu dot org
2004-04-14  1:31 ` bdavis9659 at comcast dot net
2004-04-16  7:46 ` [Bug libfortran/14942] " pinskia at gcc dot gnu dot org
2004-04-16  7:53 ` bdavis9659 at comcast dot net
2004-04-25  6:42 ` bdavis9659 at comcast dot net
2004-04-25 13:35 ` cvs-commit at gcc dot gnu dot org
2004-04-25 13:38 ` pinskia 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).