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/65792] allocation of scalar elemental function with structure constructor fails


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.


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