public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/48960] New: OPEN statement modifies NEWUNIT variable on error
@ 2011-05-11 8:51 thenlich at users dot sourceforge.net
2011-05-12 18:39 ` [Bug libfortran/48960] " jvdelisle at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: thenlich at users dot sourceforge.net @ 2011-05-11 8:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48960
Summary: OPEN statement modifies NEWUNIT variable on error
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: thenlich@users.sourceforge.net
If the NEWUNIT= specifier in the OPEN statement is used, the variable is
modified if an error occurs during the execution of the OPEN statement.
This does not conform to Fortran 2008 which demands:
9.5.6.12 NEWUNIT= specifier in the OPEN statement
1 The variable is defined with a processor determined NEWUNIT value if no error
occurs during the execution of the OPEN statement. If an error occurs, the
processor shall not change the value of the variable.
Example:
program test_newunit
integer :: st, un = 0
open (newunit=un, file='nonexisting.dat', status='old', iostat=st)
if (un /= 0) call abort
end program test_newunit
Result: If the file 'nonexisting.dat' does not exist, the program aborts.
Expected result: If the file 'nonexisting.dat' does not exist, the program
should not abort.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/48960] OPEN statement modifies NEWUNIT variable on error
2011-05-11 8:51 [Bug libfortran/48960] New: OPEN statement modifies NEWUNIT variable on error thenlich at users dot sourceforge.net
@ 2011-05-12 18:39 ` jvdelisle at gcc dot gnu.org
2012-12-25 4:24 ` jvdelisle at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-05-12 18:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48960
Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot |jvdelisle at gcc dot
|gnu.org |gnu.org
--- Comment #1 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-05-12 18:31:56 UTC ---
Ok, on my list
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/48960] OPEN statement modifies NEWUNIT variable on error
2011-05-11 8:51 [Bug libfortran/48960] New: OPEN statement modifies NEWUNIT variable on error thenlich at users dot sourceforge.net
2011-05-12 18:39 ` [Bug libfortran/48960] " jvdelisle at gcc dot gnu.org
@ 2012-12-25 4:24 ` jvdelisle at gcc dot gnu.org
2012-12-25 4:52 ` jvdelisle at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2012-12-25 4:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48960
--- Comment #2 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2012-12-25 04:24:33 UTC ---
Proposed patch being tested;:
Index: open.c
===================================================================
--- open.c (revision 194678)
+++ open.c (working copy)
@@ -844,10 +844,7 @@ st_open (st_parameter_open *opp)
if ((opp->common.flags & IOPARM_LIBRETURN_MASK) == IOPARM_LIBRETURN_OK)
{
if ((opp->common.flags & IOPARM_OPEN_HAS_NEWUNIT))
- {
- *opp->newunit = get_unique_unit_number(opp);
- opp->common.unit = *opp->newunit;
- }
+ opp->common.unit = get_unique_unit_number(opp);
u = find_or_create_unit (opp->common.unit);
if (u->s == NULL)
@@ -859,6 +856,9 @@ st_open (st_parameter_open *opp)
else
already_open (opp, u, &flags);
}
-
+
+ if ((opp->common.flags & IOPARM_LIBRETURN_MASK) == IOPARM_LIBRETURN_OK)
+ *opp->newunit = opp->common.unit;
+
library_end ();
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/48960] OPEN statement modifies NEWUNIT variable on error
2011-05-11 8:51 [Bug libfortran/48960] New: OPEN statement modifies NEWUNIT variable on error thenlich at users dot sourceforge.net
2011-05-12 18:39 ` [Bug libfortran/48960] " jvdelisle at gcc dot gnu.org
2012-12-25 4:24 ` jvdelisle at gcc dot gnu.org
@ 2012-12-25 4:52 ` jvdelisle at gcc dot gnu.org
2012-12-26 18:12 ` jvdelisle at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2012-12-25 4:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48960
--- Comment #3 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2012-12-25 04:52:04 UTC ---
A slight modification and still testing.
@@ -859,6 +856,10 @@ st_open (st_parameter_open *opp)
else
already_open (opp, u, &flags);
}
-
+
+ if ((opp->common.flags & IOPARM_OPEN_HAS_NEWUNIT)
+ && (opp->common.flags & IOPARM_LIBRETURN_MASK) == IOPARM_LIBRETURN_OK)
+ *opp->newunit = opp->common.unit;
+
library_end ();
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/48960] OPEN statement modifies NEWUNIT variable on error
2011-05-11 8:51 [Bug libfortran/48960] New: OPEN statement modifies NEWUNIT variable on error thenlich at users dot sourceforge.net
` (2 preceding siblings ...)
2012-12-25 4:52 ` jvdelisle at gcc dot gnu.org
@ 2012-12-26 18:12 ` jvdelisle at gcc dot gnu.org
2012-12-27 6:37 ` jvdelisle at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2012-12-26 18:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48960
--- Comment #4 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2012-12-26 18:11:50 UTC ---
Author: jvdelisle
Date: Wed Dec 26 18:11:42 2012
New Revision: 194724
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194724
Log:
2012-12-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/48960
* io/open.c (st_parameter_open): Assign newunit number to user
variable only if the the associated open statement is successful.
Modified:
trunk/libgfortran/ChangeLog
trunk/libgfortran/io/open.c
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/48960] OPEN statement modifies NEWUNIT variable on error
2011-05-11 8:51 [Bug libfortran/48960] New: OPEN statement modifies NEWUNIT variable on error thenlich at users dot sourceforge.net
` (3 preceding siblings ...)
2012-12-26 18:12 ` jvdelisle at gcc dot gnu.org
@ 2012-12-27 6:37 ` jvdelisle at gcc dot gnu.org
2012-12-27 20:14 ` jvdelisle at gcc dot gnu.org
2012-12-27 20:15 ` jvdelisle at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2012-12-27 6:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48960
--- Comment #5 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2012-12-27 06:37:15 UTC ---
Fixed on trunk. I will commit a test case before closing this.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/48960] OPEN statement modifies NEWUNIT variable on error
2011-05-11 8:51 [Bug libfortran/48960] New: OPEN statement modifies NEWUNIT variable on error thenlich at users dot sourceforge.net
` (4 preceding siblings ...)
2012-12-27 6:37 ` jvdelisle at gcc dot gnu.org
@ 2012-12-27 20:14 ` jvdelisle at gcc dot gnu.org
2012-12-27 20:15 ` jvdelisle at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2012-12-27 20:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48960
--- Comment #6 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2012-12-27 20:13:50 UTC ---
Author: jvdelisle
Date: Thu Dec 27 20:13:35 2012
New Revision: 194738
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194738
Log:
2012-12-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/48960
* gfortran.dg/newunit_3.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/newunit_3.f90
Modified:
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libfortran/48960] OPEN statement modifies NEWUNIT variable on error
2011-05-11 8:51 [Bug libfortran/48960] New: OPEN statement modifies NEWUNIT variable on error thenlich at users dot sourceforge.net
` (5 preceding siblings ...)
2012-12-27 20:14 ` jvdelisle at gcc dot gnu.org
@ 2012-12-27 20:15 ` jvdelisle at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2012-12-27 20:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48960
Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
--- Comment #7 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2012-12-27 20:14:56 UTC ---
Closing
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-12-27 20:15 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-11 8:51 [Bug libfortran/48960] New: OPEN statement modifies NEWUNIT variable on error thenlich at users dot sourceforge.net
2011-05-12 18:39 ` [Bug libfortran/48960] " jvdelisle at gcc dot gnu.org
2012-12-25 4:24 ` jvdelisle at gcc dot gnu.org
2012-12-25 4:52 ` jvdelisle at gcc dot gnu.org
2012-12-26 18:12 ` jvdelisle at gcc dot gnu.org
2012-12-27 6:37 ` jvdelisle at gcc dot gnu.org
2012-12-27 20:14 ` jvdelisle at gcc dot gnu.org
2012-12-27 20:15 ` 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).