public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/66039] New: ICE on incomplete parentheses at rewind, flush, endfile, backspace
@ 2015-05-06 17:15 gerhard.steinmetz.fortran@t-online.de
  2015-05-06 19:59 ` [Bug fortran/66039] " kargl at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-05-06 17:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66039

            Bug ID: 66039
           Summary: ICE on incomplete parentheses at rewind, flush,
                    endfile, backspace
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gerhard.steinmetz.fortran@t-online.de
  Target Milestone: ---

Created attachment 35483
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35483&action=edit
more code variants

An ICE occurs with incomplete parentheses at rewind, flush, endfile, backspace.
For example :

   program p
      flush ((
   end

Tested with gfortran -c, versions 4.8.3, 4.9.0, 5.1.1
on SUSE Linux 13.2 (64 bit)

The attachement contains more disrupting variants for rewind, flush, endfile,
backspace.
Interestingly, for that variants there are no ICEs for the statement wait.

Kind regards.


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

* [Bug fortran/66039] ICE on incomplete parentheses at rewind, flush, endfile, backspace
  2015-05-06 17:15 [Bug fortran/66039] New: ICE on incomplete parentheses at rewind, flush, endfile, backspace gerhard.steinmetz.fortran@t-online.de
@ 2015-05-06 19:59 ` kargl at gcc dot gnu.org
  2015-05-18 21:05 ` kargl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-05-06 19:59 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug fortran/66039] ICE on incomplete parentheses at rewind, flush, endfile, backspace
  2015-05-06 17:15 [Bug fortran/66039] New: ICE on incomplete parentheses at rewind, flush, endfile, backspace gerhard.steinmetz.fortran@t-online.de
  2015-05-06 19:59 ` [Bug fortran/66039] " kargl at gcc dot gnu.org
@ 2015-05-18 21:05 ` kargl at gcc dot gnu.org
  2015-05-19 17:13 ` kargl at gcc dot gnu.org
  2015-05-19 17:14 ` kargl at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-05-18 21:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66039

--- Comment #2 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Mon May 18 21:04:33 2015
New Revision: 223315

URL: https://gcc.gnu.org/viewcvs?rev=223315&root=gcc&view=rev
Log:
2015-05-18  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/66039
        * io.c (match_filepos): Check for incomplete/mangled REWIND, FLUSH,
        BACKSPACE, and ENDFILE statements

2015-05-18  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/66039
        * gfortran.dg/filepos1.f90: New test

Added:
    trunk/gcc/testsuite/gfortran.dg/filepos1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/io.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/66039] ICE on incomplete parentheses at rewind, flush, endfile, backspace
  2015-05-06 17:15 [Bug fortran/66039] New: ICE on incomplete parentheses at rewind, flush, endfile, backspace gerhard.steinmetz.fortran@t-online.de
  2015-05-06 19:59 ` [Bug fortran/66039] " kargl at gcc dot gnu.org
  2015-05-18 21:05 ` kargl at gcc dot gnu.org
@ 2015-05-19 17:13 ` kargl at gcc dot gnu.org
  2015-05-19 17:14 ` kargl at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-05-19 17:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66039

--- Comment #3 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Tue May 19 17:13:02 2015
New Revision: 223390

URL: https://gcc.gnu.org/viewcvs?rev=223390&root=gcc&view=rev
Log:
2015-05-19  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/66039
        * io.c (match_filepos): Check for incomplete/mangled REWIND, FLUSH,
        BACKSPACE, and ENDFILE statements

2015-05-19  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/66039
        * gfortran.dg/filepos1.f90: New test

Added:
    branches/gcc-5-branch/gcc/testsuite/gfortran.dg/filepos1.f90
Modified:
    branches/gcc-5-branch/gcc/fortran/ChangeLog
    branches/gcc-5-branch/gcc/fortran/io.c
    branches/gcc-5-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/66039] ICE on incomplete parentheses at rewind, flush, endfile, backspace
  2015-05-06 17:15 [Bug fortran/66039] New: ICE on incomplete parentheses at rewind, flush, endfile, backspace gerhard.steinmetz.fortran@t-online.de
                   ` (2 preceding siblings ...)
  2015-05-19 17:13 ` kargl at gcc dot gnu.org
@ 2015-05-19 17:14 ` kargl at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-05-19 17:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66039

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |5.2

--- Comment #4 from kargl at gcc dot gnu.org ---
Fixed on trunk and 5-branch.  Thanks for the bug report.


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

end of thread, other threads:[~2015-05-19 17:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-06 17:15 [Bug fortran/66039] New: ICE on incomplete parentheses at rewind, flush, endfile, backspace gerhard.steinmetz.fortran@t-online.de
2015-05-06 19:59 ` [Bug fortran/66039] " kargl at gcc dot gnu.org
2015-05-18 21:05 ` kargl at gcc dot gnu.org
2015-05-19 17:13 ` kargl at gcc dot gnu.org
2015-05-19 17:14 ` kargl 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).