public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/66056] New: Segmentation fault for lonely label in type
@ 2015-05-07 17:14 gerhard.steinmetz.fortran@t-online.de
  2015-05-07 17:44 ` [Bug fortran/66056] " kargl at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-05-07 17:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66056
           Summary: Segmentation fault for lonely label in type
           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: ---

This code fragment with a lonely label in a type ...
   program p
      type t
      1 !
      end type
   end

or this variation ...
   program p
      type t
      ; 1 ;
      end type
   end

produces (with gfortran 5.1.1 on SUSE Linux 13.2, 64 bit)
internal compiler error: Segmentation fault

---

Similar, but with a lonely real number instead ...
   program p
      type t
      1.2 !
      end type
   end

or this variation ...
   program p
      type t
      ; 1.2 ;
      end type
   end

leads to ...
Warning: Ignoring statement label in empty statement at (1)
(null):0: confused by earlier errors, bailing out

Kind regards.


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

* [Bug fortran/66056] Segmentation fault for lonely label in type
  2015-05-07 17:14 [Bug fortran/66056] New: Segmentation fault for lonely label in type gerhard.steinmetz.fortran@t-online.de
@ 2015-05-07 17:44 ` kargl at gcc dot gnu.org
  2015-06-17 16:56 ` gerhard.steinmetz.fortran@t-online.de
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-05-07 17:44 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

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

--- Comment #1 from kargl at gcc dot gnu.org ---
This one is interesting.  If you compile with -O or -O2,
then there is no ICE.


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

* [Bug fortran/66056] Segmentation fault for lonely label in type
  2015-05-07 17:14 [Bug fortran/66056] New: Segmentation fault for lonely label in type gerhard.steinmetz.fortran@t-online.de
  2015-05-07 17:44 ` [Bug fortran/66056] " kargl at gcc dot gnu.org
@ 2015-06-17 16:56 ` gerhard.steinmetz.fortran@t-online.de
  2015-06-17 16:59 ` gerhard.steinmetz.fortran@t-online.de
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-06-17 16:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
The following test file generates an endless compilation for every
subroutine. It's worth looking deeper.


$ cat type_with_lonely_numbers.f90
program p
   call s1
   call s2
   call s3
   call s4
   call s5
   call s6

contains

   subroutine s1
      type t
         integer :: n = 1
         1 !
         1 !
      end type
      type(t) :: a
      print *, a
   end

   subroutine s2
      type t
         integer :: n = 1
         ; 1 ;
         ; 1 ;
      end type
      type(t) :: a
      print *, a
   end

   subroutine s3
      type t
         integer :: n = 1
         1.2 !
         1.2 !
      end type
      type(t) :: a
      print *, a
   end

   subroutine s4
      type t
         integer :: n = 1
         ; 1.2 ;
         ; 1.2 ;
      end type
      type(t) :: a
      print *, a
   end

   subroutine s5
      type t
         integer :: n = 1
         1=2 !
         1=2 !
      end type
      type(t) :: a
      print *, a
   end

   subroutine s6
      type t
         integer :: n = 1
         1-2 !
         1-2 !
      end type
      type(t) :: a
      print *, a
   end
end


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

* [Bug fortran/66056] Segmentation fault for lonely label in type
  2015-05-07 17:14 [Bug fortran/66056] New: Segmentation fault for lonely label in type gerhard.steinmetz.fortran@t-online.de
  2015-05-07 17:44 ` [Bug fortran/66056] " kargl at gcc dot gnu.org
  2015-06-17 16:56 ` gerhard.steinmetz.fortran@t-online.de
@ 2015-06-17 16:59 ` gerhard.steinmetz.fortran@t-online.de
  2015-10-26 19:18 ` [Bug fortran/66056] ICEs and endless compilation for lonely labels/numbers " lkrupp at gcc dot gnu.org
  2015-10-26 19:29 ` lkrupp at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-06-17 16:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
These two do not circle around,


$ cat y1.f90
program p
   type t
      integer :: n = 1
      1 !
      2 !
   end type
   type(t) :: a
   print *, a
end


$ cat y2.f90
program p
   type t
      integer :: n = 1
      ; 1 ;
      ; 2 ;
   end type
   type(t) :: a
   print *, a
end


but answer :
f951: internal compiler error: insert_bbt(): Duplicate key found!


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

* [Bug fortran/66056] ICEs and endless compilation for lonely labels/numbers in type
  2015-05-07 17:14 [Bug fortran/66056] New: Segmentation fault for lonely label in type gerhard.steinmetz.fortran@t-online.de
                   ` (2 preceding siblings ...)
  2015-06-17 16:59 ` gerhard.steinmetz.fortran@t-online.de
@ 2015-10-26 19:18 ` lkrupp at gcc dot gnu.org
  2015-10-26 19:29 ` lkrupp at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: lkrupp at gcc dot gnu.org @ 2015-10-26 19:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from lkrupp at gcc dot gnu.org ---
Author: lkrupp
Date: Mon Oct 26 19:18:08 2015
New Revision: 229390

URL: https://gcc.gnu.org/viewcvs?rev=229390&root=gcc&view=rev
Log:
2015-10-26  Louis Krupp  <louis.krupp@zoho.com>

        PR fortran/66056
        * fortran.h: Include namespace pointer in statement label
        structure.
        * symbol.c (gfc_get_st_label): Store pointer to namespace
        that owns the statement label tree in each label.
        (gfc_free_st_label): Use namespace owning statement label
        tree when deleting statement label.
        * io.c: Initialize format_asterisk with NULL namespace pointer.

2015-10-26  Louis Krupp  <louis.krupp@zoho.com>

        PR fortran/66056
        * gfortran.dg/empty_label_typedecl.f90: New test

Added:
    trunk/gcc/testsuite/gfortran.dg/empty_label_typedecl.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/io.c
    trunk/gcc/fortran/symbol.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/66056] ICEs and endless compilation for lonely labels/numbers in type
  2015-05-07 17:14 [Bug fortran/66056] New: Segmentation fault for lonely label in type gerhard.steinmetz.fortran@t-online.de
                   ` (3 preceding siblings ...)
  2015-10-26 19:18 ` [Bug fortran/66056] ICEs and endless compilation for lonely labels/numbers " lkrupp at gcc dot gnu.org
@ 2015-10-26 19:29 ` lkrupp at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: lkrupp at gcc dot gnu.org @ 2015-10-26 19:29 UTC (permalink / raw)
  To: gcc-bugs

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

lkrupp at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |lkrupp at gcc dot gnu.org
         Resolution|---                         |FIXED

--- Comment #7 from lkrupp at gcc dot gnu.org ---
Fixed in revision 229390.

The problem: Statement labels within a type declaration are put in the
statement label tree belonging to the type declaration's namespace's (instead
of the current namespace). When the line is otherwise empty and an error is
issued, gfc_free_st_label tries to delete the label from the label tree
belonging to the current namespace and then frees the label structure, leaving
an invalid statement label pointer in the type declaration's namespace's label
tree. When that namespace is cleaned up, bad things can happen.

The attached patch stores a namespace pointer in the statement label structure
so that if a label is deleted early for some reason, it will be deleted from
the proper namespace.


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

end of thread, other threads:[~2015-10-26 19:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-07 17:14 [Bug fortran/66056] New: Segmentation fault for lonely label in type gerhard.steinmetz.fortran@t-online.de
2015-05-07 17:44 ` [Bug fortran/66056] " kargl at gcc dot gnu.org
2015-06-17 16:56 ` gerhard.steinmetz.fortran@t-online.de
2015-06-17 16:59 ` gerhard.steinmetz.fortran@t-online.de
2015-10-26 19:18 ` [Bug fortran/66056] ICEs and endless compilation for lonely labels/numbers " lkrupp at gcc dot gnu.org
2015-10-26 19:29 ` lkrupp 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).