Debian Codegraph @

gcc/testsuite/gfortran.dg/init_flag_17.f90

raw
1 ! { dg-do compile }
2 ! { dg-options "-finit-derived -finit-local-zero -fdump-tree-original" }
3 !
4 ! PR fortran/82972
5 !
6 ! Make sure we do not ICE when generating initializers for c_ptr and c_funptr
7 ! components of derived types (and make sure they are properly initialized to
8 ! zero).
9 !
10
11 program init_flag_17
12 use iso_c_binding
13 implicit none
14
15 type :: ty
16 type(c_ptr) :: ptr ! = c_null_ptr
17 type(c_funptr) :: fptr ! = c_null_funptr
18 end type
19
20 type(ty) :: t
21
22 print *, transfer(t%ptr, 0_C_INTPTR_T)
23 print *, transfer(t%fptr, 0_C_INTPTR_T)
24 end program
25
26 ! { dg-final { scan-tree-dump "\.ptr=0" "original" } }
27 ! { dg-final { scan-tree-dump "\.fptr=0" "original" } }