Debian Codegraph @

gcc/testsuite/gfortran.dg/c-interop/pr103390-3.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 non-pointer array are generated properly after fixing
6 ! pr103390, and that it does not ICE. In this case no copying is required.
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 :: i(3)
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 one loop to copy the array contents to a temporary in function i.
25 ! { dg-final { scan-tree-dump-times "while \\(1\\)" 1 "original" } }
26
27 ! It should not emit code to check the contiguous property.
28 ! { dg-final { scan-tree-dump-not "contiguous\\.\[0-9\]+" "original" } }
29