Debian Codegraph @

gcc/testsuite/gfortran.dg/c-interop/pr103390-4.f90

raw
1 ! { dg-do run }
2 ! { dg-options "-fdump-tree-original" }
3 !
4 ! Check that copy loops to ensure contiguity of the result of a function
5 ! that returns a pointer to an array are generated properly after fixing
6 ! pr103390, and that it does not ICE.
7
8 program p
9 integer, pointer :: z(:)
10 integer, target :: x(3) = [1, 2, 3]
11 z => x
12 call s(i(z))
13 contains
14 function i(x)
15 integer, pointer :: i(:)
16 integer, pointer :: x(:)
17 i => x
18 end
19 subroutine s(x) bind(c)
20 integer, contiguous :: x(:)
21 end
22 end
23
24 ! Expect a copy loop both before and after the call to S.
25 ! { dg-final { scan-tree-dump-times "while \\(1\\)" 2 "original" } }