This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/66039] ICE on incomplete parentheses at rewind, flush, endfile, backspace
- From: "kargl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 06 May 2015 19:59:52 +0000
- Subject: [Bug fortran/66039] ICE on incomplete parentheses at rewind, flush, endfile, backspace
- Auto-submitted: auto-generated
- References: <bug-66039-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66039
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-05-06
CC| |kargl at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from kargl at gcc dot gnu.org ---
Confirmed.
In io.c(gfc_resolve_filepos), the pointer fp->unit is
dereferenced without checking to see if it is NULL.
The issue appears come from match_filepos() where a
condition on checking for a valid expr is not correctly
checked.
Index: io.c
===================================================================
--- io.c (revision 222724)
+++ io.c (working copy)
@@ -2382,9 +2382,7 @@ match_filepos (gfc_statement st, gfc_exe
if (m == MATCH_NO)
{
m = gfc_match_expr (&fp->unit);
- if (m == MATCH_ERROR)
- goto done;
- if (m == MATCH_NO)
+ if (m == MATCH_ERROR || m == MATCH_NO)
goto syntax;
}
The old 'goto done' in the above patch, branches to a portion of
the code that looks for an end-of-statement,which is found. Bad
things then ensue. The above patch appears to fix ICE for the
program in comment #1.
=== gfortran Summary ===
# of expected passes 48475
# of unexpected failures 8
# of unexpected successes 8
# of expected failures 71
# of unresolved testcases 8
# of unsupported tests 70
/mnt/sgk/gcc/obj6/gcc/testsuite/gfortran/../../gfortran version 6.0.0 20150502
(experimental) (GCC)
PS: 'unexpected failures' are all related to gfortran.dg/static_linking_1.f