PR target/83368
[official-gcc.git] / gcc / testsuite / gfortran.dg / repack_arrays_1.f90
blobadf20aa9095a104fc41f5e1c76eb178285712928
1 ! { dg-do run }
2 ! { dg-options "-frepack-arrays" }
4 ! Check that arrays marked with TARGET attribute are not repacked.
6 program test2
7 use iso_c_binding
8 implicit none
9 real, target :: x(7)
10 type(c_ptr) cp1, cp2
12 x = 42
13 if (.not. c_associated(c_loc(x(3)),point(x(::2)))) call abort
14 contains
15 function point(x)
16 use iso_c_binding
17 real, intent(in), target :: x(:)
18 type(c_ptr) point
19 real, pointer :: p
21 p => x(2)
22 point = c_loc(p)
23 end function point
24 end program test2