public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32257] New: Scoping problem in implied do loop in I/O statement
@ 2007-06-08 15:38 Magnus dot Hagdorn at marsupium dot org
2007-06-10 18:09 ` [Bug fortran/32257] " tkoenig at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: Magnus dot Hagdorn at marsupium dot org @ 2007-06-08 15:38 UTC (permalink / raw)
To: gcc-bugs
The following program exposes a problem with the scoping of the loop variable
in the IO statement:
program test
implicit none
character(len=100) :: value
integer, dimension(100) :: intvalues
integer i
i = 2
intvalues = 42
value = "2 5 69"
write(*,*) len(trim(value))
read(value,*,end=20,err=20) (intvalues(i),i=1,100)
20 i=i-1
!
! This should print 1 2 5 69
!
write(*,*) i, intvalues(1:3)
!
! This prints the expected output 1 1 100
!
i = 1
intvalues = (/ (i,i=1,100) /)
print *, i, intvalues(1), intvalues(100)
end program test
--
Summary: Scoping problem in implied do loop in I/O statement
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Magnus dot Hagdorn at marsupium dot org
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32257
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug fortran/32257] Scoping problem in implied do loop in I/O statement
2007-06-08 15:38 [Bug fortran/32257] New: Scoping problem in implied do loop in I/O statement Magnus dot Hagdorn at marsupium dot org
@ 2007-06-10 18:09 ` tkoenig at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-06-10 18:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from tkoenig at gcc dot gnu dot org 2007-06-10 18:09 -------
Two points:
- The scoping is correct (i is indeed the same variable)
- i becomes undefined on exit of the implied do loop, so
the code is illegal.
http://groups.google.de/group/comp.lang.fortran/browse_thread/thread/a991e9f53d97f0ce/ca1b856d01bdbcf2?lnk=st&q=scoping+for+implied+do+loops&rnum=2#
Resolving as invalid.
--
tkoenig at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tkoenig at gcc dot gnu dot
| |org
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32257
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-06-10 18:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-08 15:38 [Bug fortran/32257] New: Scoping problem in implied do loop in I/O statement Magnus dot Hagdorn at marsupium dot org
2007-06-10 18:09 ` [Bug fortran/32257] " tkoenig 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).