public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/36942] New: iostat and/or end= and Err= don't work in read statements, unformatted reads
@ 2008-07-25 22:31 michael dot e dot olsen at nasa dot gov
2008-07-25 22:36 ` [Bug fortran/36942] " michael dot e dot olsen at nasa dot gov
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: michael dot e dot olsen at nasa dot gov @ 2008-07-25 22:31 UTC (permalink / raw)
To: gcc-bugs
Coding to detect end of file or read error just won't work, and I can't see a
work around. Coding to differentiate between end of file and error condition
doesn't work, it all acts like an error.
I have a test code, included below, which creates a simple unformatted file
with two records. The first record contains a single integer, and the second
record contains three integers.
Once this test file is created, it is re-opened and read, attempting a read of
three integers, rather than 1 integer, on the first record. This should create
a error condition, and it should write out the stop error message stating so.
Instead, it writes out the message for the END=100 label.
Using IOSTAT doesn't differentiate between end= and err= conditions either, it
seems to return 0 for no problems, and -1 for anything else...
Code has been run on opteron, centrino, and itanium systems, all running linux
(fedora core 8 on the first two, last Suse)
!---Relevant Code follows----
integer ni, nj, nk
ni = 1
nj = 1
nk = 1
open(1,file='test.data',form='unformatted')
write(1) ni
write(1) ni,nj,nk
close(1)
ni = 0
nj = 0
nk = 0
open(1,file='test.data',form='unformatted')
read(1,err=10,end=100)ni,nj,nk
write(*,*)ni, nj, nk
stop 'No End, No ERror'
10 continue
write(*,*)ni, nj, nk
stop 'ERror'
100 continue
write(*,*)ni, nj, nk
stop 'End'
end
!-------------------End of Code ----------------
--
Summary: iostat and/or end= and Err= don't work in read
statements, unformatted reads
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: michael dot e dot olsen at nasa dot gov
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36942
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/36942] iostat and/or end= and Err= don't work in read statements, unformatted reads
2008-07-25 22:31 [Bug fortran/36942] New: iostat and/or end= and Err= don't work in read statements, unformatted reads michael dot e dot olsen at nasa dot gov
@ 2008-07-25 22:36 ` michael dot e dot olsen at nasa dot gov
2008-07-25 22:38 ` michael dot e dot olsen at nasa dot gov
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: michael dot e dot olsen at nasa dot gov @ 2008-07-25 22:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from michael dot e dot olsen at nasa dot gov 2008-07-25 22:35 -------
Created an attachment (id=15962)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15962&action=view)
Coding to reproduce bug described
Didn't know I could add attachment. I'll add one demonstrating that iostat has
the same behavior
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36942
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/36942] iostat and/or end= and Err= don't work in read statements, unformatted reads
2008-07-25 22:31 [Bug fortran/36942] New: iostat and/or end= and Err= don't work in read statements, unformatted reads michael dot e dot olsen at nasa dot gov
2008-07-25 22:36 ` [Bug fortran/36942] " michael dot e dot olsen at nasa dot gov
@ 2008-07-25 22:38 ` michael dot e dot olsen at nasa dot gov
2008-07-25 22:41 ` kargl at gcc dot gnu dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: michael dot e dot olsen at nasa dot gov @ 2008-07-25 22:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from michael dot e dot olsen at nasa dot gov 2008-07-25 22:37 -------
Created an attachment (id=15963)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15963&action=view)
Version showing iostat isn't distinguishing either.
This version is a little more involved, and opens and closes the file to create
error and end conditions. iostat allways returns 0 for normal cases, and -1
for either end or error conditions
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36942
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/36942] iostat and/or end= and Err= don't work in read statements, unformatted reads
2008-07-25 22:31 [Bug fortran/36942] New: iostat and/or end= and Err= don't work in read statements, unformatted reads michael dot e dot olsen at nasa dot gov
2008-07-25 22:36 ` [Bug fortran/36942] " michael dot e dot olsen at nasa dot gov
2008-07-25 22:38 ` michael dot e dot olsen at nasa dot gov
@ 2008-07-25 22:41 ` kargl at gcc dot gnu dot org
2008-07-25 22:45 ` kargl at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: kargl at gcc dot gnu dot org @ 2008-07-25 22:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from kargl at gcc dot gnu dot org 2008-07-25 22:41 -------
Update your ancient compiler.
troutmask:sgk[211] gfc --version
GNU Fortran (GCC) 4.2.5 20080702 (prerelease)
troutmask:sgk[212] gfc -o z m.f
troutmask:sgk[213] ./z
1 0 0
STOP ERror
troutmask:sgk[214] gfc4x --version
GNU Fortran (GCC) 4.4.0 20080611 (experimental)
troutmask:sgk[215] gfc4x -o z m.f
troutmask:sgk[216] ./z
1 0 0
STOP ERror
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36942
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/36942] iostat and/or end= and Err= don't work in read statements, unformatted reads
2008-07-25 22:31 [Bug fortran/36942] New: iostat and/or end= and Err= don't work in read statements, unformatted reads michael dot e dot olsen at nasa dot gov
` (2 preceding siblings ...)
2008-07-25 22:41 ` kargl at gcc dot gnu dot org
@ 2008-07-25 22:45 ` kargl at gcc dot gnu dot org
2008-07-25 22:52 ` michael dot e dot olsen at nasa dot gov
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: kargl at gcc dot gnu dot org @ 2008-07-25 22:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from kargl at gcc dot gnu dot org 2008-07-25 22:45 -------
Your iostat code with the same compilers shows
troutmask:sgk[219] ./z
ival(should indicate normal) 0
ival(should indicate normal) 0
ival(should indicate end) -1
File closed and then reopened for errors...
ival(should indicate error) 17
STOP making sense
troutmask:sgk[220] gfc4x -o z n.f
troutmask:sgk[221] ./z
ival(should indicate normal) 0
ival(should indicate normal) 0
ival(should indicate end) -1
File closed and then reopened for errors...
ival(should indicate error) 5016
STOP making sense
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36942
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/36942] iostat and/or end= and Err= don't work in read statements, unformatted reads
2008-07-25 22:31 [Bug fortran/36942] New: iostat and/or end= and Err= don't work in read statements, unformatted reads michael dot e dot olsen at nasa dot gov
` (3 preceding siblings ...)
2008-07-25 22:45 ` kargl at gcc dot gnu dot org
@ 2008-07-25 22:52 ` michael dot e dot olsen at nasa dot gov
2008-07-26 0:10 ` kyon at verizon dot net
2008-07-26 1:19 ` kargl at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: michael dot e dot olsen at nasa dot gov @ 2008-07-25 22:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from michael dot e dot olsen at nasa dot gov 2008-07-25 22:51 -------
Created an attachment (id=15964)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15964&action=view)
Version showing iostat isn't distinguishing either.
This version is a little more involved, and opens and closes the file to create
error and end conditions. iostat allways returns 0 for normal cases, and -1
for either end or error conditions
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36942
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/36942] iostat and/or end= and Err= don't work in read statements, unformatted reads
2008-07-25 22:31 [Bug fortran/36942] New: iostat and/or end= and Err= don't work in read statements, unformatted reads michael dot e dot olsen at nasa dot gov
` (4 preceding siblings ...)
2008-07-25 22:52 ` michael dot e dot olsen at nasa dot gov
@ 2008-07-26 0:10 ` kyon at verizon dot net
2008-07-26 1:19 ` kargl at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: kyon at verizon dot net @ 2008-07-26 0:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from kyon at verizon dot net 2008-07-26 00:10 -------
Subject: Re: iostat and/or end= and Err= don't work in read
statements, unformatted reads
Kargl
Thanks. I'm now in the process of attempting to update my gcc
collection to at least 4.3.
If you can verify this will work, I'd appreciate it. (I'm using fedora,
and fc9 has 4.3).
If you can't, still thanks. This at least means I'm not going
completely bonkers.
### Ok, my email situation is so bad, I got the newer compilers
installed and working, and 4.3.0-8, specifically the fc9 version,
gcc-gfortran-4.3.0-8, is working like a champ. This before this message
actually made it off my machine. ###
Thanks again, this really helped me out
Mike
PS, I like the replica...
kargl at gcc dot gnu dot org wrote:
> ------- Comment #3 from kargl at gcc dot gnu dot org 2008-07-25 22:41 -------
> Update your ancient compiler.
>
> troutmask:sgk[211] gfc --version
> GNU Fortran (GCC) 4.2.5 20080702 (prerelease)
> troutmask:sgk[212] gfc -o z m.f
> troutmask:sgk[213] ./z
> 1 0 0
> STOP ERror
>
> troutmask:sgk[214] gfc4x --version
> GNU Fortran (GCC) 4.4.0 20080611 (experimental)
> troutmask:sgk[215] gfc4x -o z m.f
> troutmask:sgk[216] ./z
> 1 0 0
> STOP ERror
>
>
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36942
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/36942] iostat and/or end= and Err= don't work in read statements, unformatted reads
2008-07-25 22:31 [Bug fortran/36942] New: iostat and/or end= and Err= don't work in read statements, unformatted reads michael dot e dot olsen at nasa dot gov
` (5 preceding siblings ...)
2008-07-26 0:10 ` kyon at verizon dot net
@ 2008-07-26 1:19 ` kargl at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: kargl at gcc dot gnu dot org @ 2008-07-26 1:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from kargl at gcc dot gnu dot org 2008-07-26 01:18 -------
(In reply to comment #6)
> Kargl
>
> Thanks again, this really helped me out
>
> Mike
>
> PS, I like the replica...
>
The problem does not appear in 4.2.5 or 4.4.0. I don't have
a 4.3.1 compiler installed, so can't tested. I'm closing
this as FIXED.
PS: Most people don't know about Trout Mask Replica.
--
kargl at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36942
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-07-26 1:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-25 22:31 [Bug fortran/36942] New: iostat and/or end= and Err= don't work in read statements, unformatted reads michael dot e dot olsen at nasa dot gov
2008-07-25 22:36 ` [Bug fortran/36942] " michael dot e dot olsen at nasa dot gov
2008-07-25 22:38 ` michael dot e dot olsen at nasa dot gov
2008-07-25 22:41 ` kargl at gcc dot gnu dot org
2008-07-25 22:45 ` kargl at gcc dot gnu dot org
2008-07-25 22:52 ` michael dot e dot olsen at nasa dot gov
2008-07-26 0:10 ` kyon at verizon dot net
2008-07-26 1:19 ` kargl 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).