This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/64230] New: Segmentation fault - invalid memory reference in a compiler-generated finalizer for a complicated type hierarchy when a polymorphic variable is allocated in an external procedure.


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

            Bug ID: 64230
           Summary: Segmentation fault - invalid memory reference in a
                    compiler-generated finalizer for a complicated type
                    hierarchy when a polymorphic variable is allocated in
                    an external procedure.
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mathewc at nag dot co.uk

> uname -a
Linux whakarewarewa.nag.co.uk 3.17.4-301.fc21.x86_64 #1 SMP Thu Nov 27 19:09:10
UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

> gfortran --version
GNU Fortran (GCC) 4.9.2 20141101 (Red Hat 4.9.2-1)

> cat test.f90
Module m
  Implicit None
  Type, Public :: t1
    Integer, Allocatable :: i(:)
  End Type
  Type, Public :: t2
    Integer, Allocatable :: i(:)
  End Type
  Type, Public :: t3
    Type (t2) :: t
  End Type
  Type, Public :: t4
  End Type
  Type, Public, Extends (t4) :: t5
    Type (t1) :: t_c1
  End Type
  Type, Public, Extends (t4) :: t6
    Type (t5) :: t_c2
  End Type
  Type, Public, Extends (t6) :: t7
    Type (t3) :: t_c3
  End Type
End Module
Program main
  Use m
  Implicit None
  Interface
    Subroutine s(t)
      Use m
      Class (t4), Allocatable, Intent (Out) :: t
    End Subroutine
  End Interface
  Class (t4), Allocatable :: t
  Call s(t)
  Deallocate (t)
End Program
Subroutine s(t)
  Use m
  Class (t4), Allocatable, Intent (Out) :: t
  Allocate (t7 :: t)
End Subroutine

> gfortran test.f90 && ./a.out

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x2B18DDE51517
#1  0x2B18DDE51B5E
#2  0x3E2B23494F
#3  0x401294 in __final_m_T6.2389 at test.f90:?
#4  0x400BEE in __final_m_T7.2378 at test.f90:?
#5  0x40159A in MAIN__ at test.f90:?
Segmentation fault (core dumped)

PS This works OK with 4.8.3.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]