This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/65792] allocation of scalar elemental function with structure constructor fails
- From: "dominiq at lps dot ens.fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 17 Apr 2015 22:48:43 +0000
- Subject: [Bug fortran/65792] allocation of scalar elemental function with structure constructor fails
- Auto-submitted: auto-generated
- References: <bug-65792-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65792
--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Created attachment 35346 [details]
> draft patch, untested
The patch fixes the PR, but causes
FAIL: gfortran.dg/class_19.f03 -O0 execution test
FAIL: gfortran.dg/class_19.f03 -O1 execution test
FAIL: gfortran.dg/class_19.f03 -O2 execution test
FAIL: gfortran.dg/class_19.f03 -O3 -fomit-frame-pointer execution test
FAIL: gfortran.dg/class_19.f03 -O3 -fomit-frame-pointer -funroll-loops
execution test
FAIL: gfortran.dg/class_19.f03 -O3 -fomit-frame-pointer -funroll-all-loops
-finline-functions execution test
FAIL: gfortran.dg/class_19.f03 -O3 -g execution test
FAIL: gfortran.dg/class_19.f03 -Os execution test
FAIL: gfortran.dg/class_19.f03 -g -flto execution test
reduced test
module foo_mod
type foo_inner
integer, allocatable :: v(:)
end type foo_inner
type foo_outer
class(foo_inner), allocatable :: int
end type foo_outer
contains
subroutine foo_checkit()
implicit none
type(foo_outer),allocatable :: try2
allocate(try2)
if (allocated(try2%int)) call abort()
end subroutine foo_checkit
end module foo_mod
program main
use foo_mod
implicit none
call foo_checkit()
end program main
which gives at run time
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.