[Bug fortran/82842] (PDT) Constructors do not work

pault at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Nov 5 13:42:00 GMT 2017


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

--- Comment #1 from Paul Thomas <pault at gcc dot gnu.org> ---
A related bug from:
https://groups.google.com/forum/#!topic/comp.lang.fortran/NDE6JKTFbNU

module mod1
   implicit none
   type s3(selector)
      integer, len :: selector
      character key(selector)
   end type s3
   type s4
      type(s3(:)), allocatable :: key
   end type s4
end module mod1

program main
   use mod1
   implicit none
   type(s3(:)), allocatable :: x
   type(s3(:)), allocatable :: z
   type(s4) u
   type(s4) v
   x = s3(2)(transfer('Xe',['x']))
   write(*,*) 'ALLOCATED(x) = ',ALLOCATED(x)
   write(*,*) 'x%selector = ',x%selector
   write(*,*) 'x%key = ',x%key
   z = x
   write(*,*) 'ALLOCATED(z) = ',ALLOCATED(z)
   write(*,*) 'z%selector = ',z%selector
   write(*,*) 'z%key = ',z%key
   u = s4(x)
   write(*,*) 'ALLOCATED(u%key) = ',ALLOCATED(u%key)
   write(*,*) 'u%key%selector = ',u%key%selector
   write(*,*) 'u%key%key = ',u%key%key
   v = u
   write(*,*) 'ALLOCATED(v%key) = ',ALLOCATED(v%key)
   write(*,*) 'v%key%selector = ',v%key%selector
   write(*,*) 'v%key%key = ',v%key%key
end program main 

gfortran.exe -c p.f90 -o p.o
f951.exe: internal compiler error: Segmentation fault


More information about the Gcc-bugs mailing list