public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/57895] New: Segmentation fault in gfc_restore_last_undo_checkpoint
@ 2013-07-15  6:34 zeccav at gmail dot com
  2013-07-15 10:11 ` [Bug fortran/57895] " burnus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zeccav at gmail dot com @ 2013-07-15  6:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57895

            Bug ID: 57895
           Summary: Segmentation fault in gfc_restore_last_undo_checkpoint
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zeccav at gmail dot com

Created attachment 30503
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30503&action=edit
Old dusty Fortran file

The attached old dusty Fortran produces 
a Segmentation fault in gfc_restore_last_undo_checkpoint.
Compiles fine with -fdollar-ok


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

* [Bug fortran/57895] Segmentation fault in gfc_restore_last_undo_checkpoint
  2013-07-15  6:34 [Bug fortran/57895] New: Segmentation fault in gfc_restore_last_undo_checkpoint zeccav at gmail dot com
@ 2013-07-15 10:11 ` burnus at gcc dot gnu.org
  2013-07-15 10:50 ` mikael at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-07-15 10:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57895

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic,
                   |                            |ice-on-invalid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-07-15
                 CC|                            |burnus at gcc dot gnu.org
      Known to work|                            |4.1.2
     Ever confirmed|0                           |1
      Known to fail|                            |4.3.4, 4.5.3, 4.6.3, 4.7.3,
                   |                            |4.8.1, 4.9.0

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
That's a regression. GCC 4.1 gives:
   Error: Syntax error in COMMON statement at (1)
due to the '$' (and exits without failure). But GCC 4.3 and later segfault.


I think one should apply the following patch to give a good error message
(instead of none). However, it does not prevent the segfault.

--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -557,6 +557,6 @@ gfc_match_name (char *buffer)
   if (c == '$' && !gfc_option.flag_dollar_ok)
     {
-      gfc_error ("Invalid character '$' at %C. Use -fdollar-ok to allow it "
-                "as an extension");
+      gfc_error_now ("Invalid character '$' at %C. Use -fdollar-ok to allow it
"
+                    "as an extension");
       return MATCH_ERROR;
     }


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

* [Bug fortran/57895] Segmentation fault in gfc_restore_last_undo_checkpoint
  2013-07-15  6:34 [Bug fortran/57895] New: Segmentation fault in gfc_restore_last_undo_checkpoint zeccav at gmail dot com
  2013-07-15 10:11 ` [Bug fortran/57895] " burnus at gcc dot gnu.org
@ 2013-07-15 10:50 ` mikael at gcc dot gnu.org
  2013-07-17 13:00 ` burnus at gcc dot gnu.org
  2013-07-17 13:00 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mikael at gcc dot gnu.org @ 2013-07-15 10:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57895

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #2 from Mikael Morin <mikael at gcc dot gnu.org> ---
gfc_restore_last_undo_checkpoint seems to take care of the cleanup, so we don't
need to do it in gfc_match_common.
The following fixes the segfault.

--- a/match.c
+++ b/match.c
@@ -4520,10 +4520,6 @@ syntax:
   gfc_syntax_error (ST_COMMON);

 cleanup:
-  if (old_blank_common)
-    old_blank_common->common_next = NULL;
-  else
-    gfc_current_ns->blank_common.head = NULL;
   gfc_free_array_spec (as);
   return MATCH_ERROR;
 }


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

* [Bug fortran/57895] Segmentation fault in gfc_restore_last_undo_checkpoint
  2013-07-15  6:34 [Bug fortran/57895] New: Segmentation fault in gfc_restore_last_undo_checkpoint zeccav at gmail dot com
                   ` (2 preceding siblings ...)
  2013-07-17 13:00 ` burnus at gcc dot gnu.org
@ 2013-07-17 13:00 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-07-17 13:00 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57895

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
FIXED on the trunk (GCC 4.9).

Thanks for the report!


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

* [Bug fortran/57895] Segmentation fault in gfc_restore_last_undo_checkpoint
  2013-07-15  6:34 [Bug fortran/57895] New: Segmentation fault in gfc_restore_last_undo_checkpoint zeccav at gmail dot com
  2013-07-15 10:11 ` [Bug fortran/57895] " burnus at gcc dot gnu.org
  2013-07-15 10:50 ` mikael at gcc dot gnu.org
@ 2013-07-17 13:00 ` burnus at gcc dot gnu.org
  2013-07-17 13:00 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-07-17 13:00 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57895

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---


Author: burnus
Date: Wed Jul 17 12:57:41 2013
New Revision: 201008

URL: http://gcc.gnu.org/viewcvs?rev=201008&root=gcc&view=rev
Log:
2013-07-17  Mikael Morin  <mikael@gcc.gnu.org>
            Tobias Burnus  <burnus@net-b.de>

        PR fortran/57895
        * match.c (gfc_match_name): Ensure that the error
        message regarding -fdollar-ok gets printed.
        (gfc_match_common): Avoid multiple freeing.

2013-07-17  Tobias Burnus  <burnus@net-b.de>

        PR fortran/57895
        * gfortran.dg/dollar_sym_3.f: New.
        * gfortran.dg/dollar_sym_1.f90: Update dg-error.


Added:
    trunk/gcc/testsuite/gfortran.dg/dollar_sym_3.f
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/match.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/dollar_sym_1.f90


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

end of thread, other threads:[~2013-07-17 13:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-15  6:34 [Bug fortran/57895] New: Segmentation fault in gfc_restore_last_undo_checkpoint zeccav at gmail dot com
2013-07-15 10:11 ` [Bug fortran/57895] " burnus at gcc dot gnu.org
2013-07-15 10:50 ` mikael at gcc dot gnu.org
2013-07-17 13:00 ` burnus at gcc dot gnu.org
2013-07-17 13:00 ` burnus 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).