public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/48706] New: [OOP] ICE (segfault) with TBP
@ 2011-04-20 19:40 burnus at gcc dot gnu.org
  2011-05-18 22:01 ` [Bug fortran/48706] Type extension inside subroutine janus at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-04-20 19:40 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [OOP] ICE (segfault) with TBP
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: janus@gcc.gnu.org


The following program (tbp_diffscope_01_pos.f90) fails with an ICE (segfault)

The test case is part of LRZ's fortran_tests.


module mod_diff_01
  implicit none
  type :: foo
     integer :: i = -1
  contains
     procedure :: pfoo
  end type
contains
  subroutine pfoo(this, i)
    class(foo) :: this
    integer :: i
    this%i = i
    select type(this)
    type is (foo)
       write(*, *) 'FAIL'
    class default
       write(*, *) 'OK'
    end select
  end subroutine pfoo
  subroutine create_ext(this)
    type, extends(foo) :: foo_e
       real :: r = 0.0
    end type foo_e
    class(foo), allocatable :: this
    allocate(foo_e :: this)
    call this%pfoo(1)
! ifort 11.1U6 crash at TBP call (premier issue 590191)
  end subroutine create_ext
end module mod_diff_01
program diff_01
  use mod_diff_01
  implicit none
  class(foo), allocatable :: o
  call create_ext(o)
end program diff_01


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

* [Bug fortran/48706] Type extension inside subroutine
  2011-04-20 19:40 [Bug fortran/48706] New: [OOP] ICE (segfault) with TBP burnus at gcc dot gnu.org
@ 2011-05-18 22:01 ` janus at gcc dot gnu.org
  2011-05-18 22:07 ` janus at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: janus at gcc dot gnu.org @ 2011-05-18 22:01 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.05.18 21:49:33
            Summary|[OOP] ICE (segfault) with   |Type extension inside
                   |TBP                         |subroutine
     Ever Confirmed|0                           |1

--- Comment #1 from janus at gcc dot gnu.org 2011-05-18 21:49:33 UTC ---
Reduced (non-polymorphic) test case:


module mod_diff_01
  implicit none
  type :: foo
  end type
contains
  subroutine create_ext()
    type, extends(foo) :: foo_e
    end type foo_e
  end subroutine create_ext
end module mod_diff_01

program diff_01
  use mod_diff_01
  implicit none
  call create_ext()
end program diff_01 


Apparently the segfault is simply due to the type extension happening inside a
subroutine (which is rather unusual but perfectly valid, I think).


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

* [Bug fortran/48706] Type extension inside subroutine
  2011-04-20 19:40 [Bug fortran/48706] New: [OOP] ICE (segfault) with TBP burnus at gcc dot gnu.org
  2011-05-18 22:01 ` [Bug fortran/48706] Type extension inside subroutine janus at gcc dot gnu.org
@ 2011-05-18 22:07 ` janus at gcc dot gnu.org
  2011-05-18 23:07 ` janus at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: janus at gcc dot gnu.org @ 2011-05-18 22:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from janus at gcc dot gnu.org 2011-05-18 21:50:42 UTC ---
gdb shows the following backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x000000000050f8fc in load_derived_extensions () at
/home/jweil/gcc47/trunk/gcc/fortran/module.c:4134
4134                  dt = st->n.sym;
(gdb) bt
#0  0x000000000050f8fc in load_derived_extensions () at
/home/jweil/gcc47/trunk/gcc/fortran/module.c:4134
#1  0x000000000051062a in read_module () at
/home/jweil/gcc47/trunk/gcc/fortran/module.c:4593
#2  0x000000000051351b in gfc_use_module () at
/home/jweil/gcc47/trunk/gcc/fortran/module.c:5764
#3  0x000000000051b7f0 in accept_statement (st=ST_USE) at
/home/jweil/gcc47/trunk/gcc/fortran/parse.c:1577
#4  0x000000000051cd8a in parse_spec (st=ST_USE) at
/home/jweil/gcc47/trunk/gcc/fortran/parse.c:2575
#5  0x000000000051ea05 in parse_progunit (st=ST_NONE) at
/home/jweil/gcc47/trunk/gcc/fortran/parse.c:3926
#6  0x000000000051f56c in gfc_parse_file () at
/home/jweil/gcc47/trunk/gcc/fortran/parse.c:4355
#7  0x000000000056535b in gfc_be_parse_file () at
/home/jweil/gcc47/trunk/gcc/fortran/f95-lang.c:250
#8  0x0000000000ae8bdc in compile_file () at
/home/jweil/gcc47/trunk/gcc/toplev.c:570
#9  0x0000000000aeaddd in do_compile () at
/home/jweil/gcc47/trunk/gcc/toplev.c:1905
#10 0x0000000000aeaf4a in toplev_main (argc=2, argv=0x7fffffffdd78) at
/home/jweil/gcc47/trunk/gcc/toplev.c:1977
#11 0x0000000000615f1c in main (argc=2, argv=0x7fffffffdd78) at
/home/jweil/gcc47/trunk/gcc/main.c:36


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

* [Bug fortran/48706] Type extension inside subroutine
  2011-04-20 19:40 [Bug fortran/48706] New: [OOP] ICE (segfault) with TBP burnus at gcc dot gnu.org
  2011-05-18 22:01 ` [Bug fortran/48706] Type extension inside subroutine janus at gcc dot gnu.org
  2011-05-18 22:07 ` janus at gcc dot gnu.org
@ 2011-05-18 23:07 ` janus at gcc dot gnu.org
  2011-05-20  9:23 ` janus at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: janus at gcc dot gnu.org @ 2011-05-18 23:07 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #3 from janus at gcc dot gnu.org 2011-05-18 22:39:06 UTC ---
Early patch (not regtested):


Index: gcc/fortran/module.c
===================================================================
--- gcc/fortran/module.c    (Revision 173873)
+++ gcc/fortran/module.c    (Arbeitskopie)
@@ -4817,6 +4817,9 @@ write_dt_extensions (gfc_symtree *st)
 {
   if (!gfc_check_symbol_access (st->n.sym))
     return;
+  if (!(st->n.sym->ns && st->n.sym->ns->proc_name
+    && st->n.sym->ns->proc_name->attr.flavor == FL_MODULE))
+    return;

   mio_lparen ();
   mio_pool_string (&st->n.sym->name);


Prevents writing the dt into the mod file, if its parent ns is not a module
(but a subroutine).


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

* [Bug fortran/48706] Type extension inside subroutine
  2011-04-20 19:40 [Bug fortran/48706] New: [OOP] ICE (segfault) with TBP burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-05-18 23:07 ` janus at gcc dot gnu.org
@ 2011-05-20  9:23 ` janus at gcc dot gnu.org
  2011-05-20  9:53 ` burnus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: janus at gcc dot gnu.org @ 2011-05-20  9:23 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot       |janus at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #4 from janus at gcc dot gnu.org 2011-05-20 08:45:59 UTC ---
(In reply to comment #3)
> Early patch (not regtested):

The patch in comment #3 regtests successfully.


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

* [Bug fortran/48706] Type extension inside subroutine
  2011-04-20 19:40 [Bug fortran/48706] New: [OOP] ICE (segfault) with TBP burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-05-20  9:23 ` janus at gcc dot gnu.org
@ 2011-05-20  9:53 ` burnus at gcc dot gnu.org
  2011-05-20 18:36 ` janus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-05-20  9:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-05-20 09:35:30 UTC ---
(In reply to comment #4)
> The patch in comment #3 regtests successfully.

Patch looks OK.
Thus, you can commit it with a test case and a changelog - and with posting the
patch to gcc-patches@/fortran@.

Thanks for fixing the PR.


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

* [Bug fortran/48706] Type extension inside subroutine
  2011-04-20 19:40 [Bug fortran/48706] New: [OOP] ICE (segfault) with TBP burnus at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-05-20  9:53 ` burnus at gcc dot gnu.org
@ 2011-05-20 18:36 ` janus at gcc dot gnu.org
  2011-05-20 18:46 ` janus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: janus at gcc dot gnu.org @ 2011-05-20 18:36 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

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

--- Comment #7 from janus at gcc dot gnu.org 2011-05-20 18:10:21 UTC ---
Fixed with r173966. Closing.


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

* [Bug fortran/48706] Type extension inside subroutine
  2011-04-20 19:40 [Bug fortran/48706] New: [OOP] ICE (segfault) with TBP burnus at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2011-05-20 18:36 ` janus at gcc dot gnu.org
@ 2011-05-20 18:46 ` janus at gcc dot gnu.org
  2011-10-04 11:07 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: janus at gcc dot gnu.org @ 2011-05-20 18:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from janus at gcc dot gnu.org 2011-05-20 18:05:29 UTC ---
Author: janus
Date: Fri May 20 18:05:26 2011
New Revision: 173966

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173966
Log:
2011-05-20  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/48706
    * module.c (write_dt_extensions): Do not write extended types which
    are local to a subroutine.

2011-05-20  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/48706
    * gfortran.dg/extends_12.f03: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/extends_12.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/module.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/48706] Type extension inside subroutine
  2011-04-20 19:40 [Bug fortran/48706] New: [OOP] ICE (segfault) with TBP burnus at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2011-05-20 18:46 ` janus at gcc dot gnu.org
@ 2011-10-04 11:07 ` jakub at gcc dot gnu.org
  2011-10-04 20:44 ` janus at gcc dot gnu.org
  2011-10-04 20:46 ` janus at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-10-04 11:07 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-10-04 11:06:47 UTC ---
This ICEs also on the 4.6 branch.  Could you please apply it there too?


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

* [Bug fortran/48706] Type extension inside subroutine
  2011-04-20 19:40 [Bug fortran/48706] New: [OOP] ICE (segfault) with TBP burnus at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2011-10-04 11:07 ` jakub at gcc dot gnu.org
@ 2011-10-04 20:44 ` janus at gcc dot gnu.org
  2011-10-04 20:46 ` janus at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: janus at gcc dot gnu.org @ 2011-10-04 20:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from janus at gcc dot gnu.org 2011-10-04 20:44:14 UTC ---
Author: janus
Date: Tue Oct  4 20:44:10 2011
New Revision: 179524

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179524
Log:
2011-10-04  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/48706
    * module.c (write_dt_extensions): Do not write extended types which
    are local to a subroutine.


2011-10-04  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/48706
    * gfortran.dg/extends_12.f03: New.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/extends_12.f03
Modified:
    branches/gcc-4_6-branch/gcc/fortran/ChangeLog
    branches/gcc-4_6-branch/gcc/fortran/module.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/48706] Type extension inside subroutine
  2011-04-20 19:40 [Bug fortran/48706] New: [OOP] ICE (segfault) with TBP burnus at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2011-10-04 20:44 ` janus at gcc dot gnu.org
@ 2011-10-04 20:46 ` janus at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: janus at gcc dot gnu.org @ 2011-10-04 20:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from janus at gcc dot gnu.org 2011-10-04 20:45:52 UTC ---
(In reply to comment #8)
> This ICEs also on the 4.6 branch.  Could you please apply it there too?

Sure thing. Committed as r179524.


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

end of thread, other threads:[~2011-10-04 20:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-20 19:40 [Bug fortran/48706] New: [OOP] ICE (segfault) with TBP burnus at gcc dot gnu.org
2011-05-18 22:01 ` [Bug fortran/48706] Type extension inside subroutine janus at gcc dot gnu.org
2011-05-18 22:07 ` janus at gcc dot gnu.org
2011-05-18 23:07 ` janus at gcc dot gnu.org
2011-05-20  9:23 ` janus at gcc dot gnu.org
2011-05-20  9:53 ` burnus at gcc dot gnu.org
2011-05-20 18:36 ` janus at gcc dot gnu.org
2011-05-20 18:46 ` janus at gcc dot gnu.org
2011-10-04 11:07 ` jakub at gcc dot gnu.org
2011-10-04 20:44 ` janus at gcc dot gnu.org
2011-10-04 20:46 ` janus 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).