The following code (from pr40737) ! { dg-do compile } module testmod implicit none type VARIABLES_MAILLE real :: cell_var end type VARIABLES_MAILLE type (VARIABLES_MAILLE), pointer, dimension( :) :: Hydro_vars real, pointer, dimension(:) :: Ro end module testmod
program TF_AD_SPLITTING_DRIVER_PLANE use testmod implicit none Ro => Hydro_vars(1:2)%cell_var end program gives a Segmentation fault when compiled with -fwhole-file. The backtrace is Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000018 0x00000001000d1d38 in gfc_trans_pointer_assignment (expr1=0x14191a3f0, expr2=0x141919960) at ../../work/gcc/fortran/trans-expr.c:4768 4768 gfc_add_modify (&lse.post, GFC_DECL_SPAN(decl), tmp); (gdb) bt #0 0x00000001000d1d38 in gfc_trans_pointer_assignment (expr1=0x14191a3f0, expr2=0x141919960) at ../../work/gcc/fortran/trans-expr.c:4768 #1 0x00000001000a9ae6 in trans_code (code=0x14191a960, cond=0x0) at ../../work/gcc/fortran/trans.c:1109 #2 0x00000001000c7bd2 in gfc_generate_function_code (ns=<value temporarily unavailable, due to optimizations>) at ../../work/gcc/fortran/trans-decl.c:4495 #3 0x000000010006b0bd in gfc_parse_file () at ../../work/gcc/fortran/parse.c:4253 #4 0x00000001000a496c in gfc_be_parse_file (set_yydebug=<value temporarily unavailable, due to optimizations>) at ../../work/gcc/fortran/f95-lang.c:241 #5 0x00000001006990da in toplev_main (argc=2, argv=0x7fff5fbfd9d8) at ../../work/gcc/toplev.c:945 #6 0x0000000100001154 in start () -- Summary: Segmentation fault with -fwhole-file Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dominiq at lps dot ens dot fr http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45128