OSDN Git Service

PR debug/43983
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / repack_arrays_1.f90
1 ! { dg-do run }
2 ! { dg-options "-frepack-arrays" }
3 !
4 ! Check that arrays marked with TARGET attribute are not repacked.
5 !
6 program test2
7    use iso_c_binding
8    implicit none
9    real, target :: x(7)
10    type(c_ptr) cp1, cp2
11
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
20
21     p => x(2)
22     point = c_loc(p)
23   end function point
24 end program test2