| 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. This variant is for an intent(in) |
| 7 |
! dummy argument so no copy-out is needed, only copy-in. |
| 8 |
|
| 9 |
program p |
| 10 |
integer, pointer :: z(:) |
| 11 |
integer, target :: x(3) = [1, 2, 3] |
| 12 |
z => x |
| 13 |
call s(i(z)) |
| 14 |
contains |
| 15 |
function i(x) |
| 16 |
integer, pointer :: i(:) |
| 17 |
integer, pointer :: x(:) |
| 18 |
i => x |
| 19 |
end |
| 20 |
subroutine s(x) bind(c) |
| 21 |
integer, contiguous, intent(in) :: x(:) |
| 22 |
end |
| 23 |
end |
| 24 |
|
| 25 |
! Expect a copy loop before the call to S. |
| 26 |
! { dg-final { scan-tree-dump-times "while \\(1\\)" 1 "original" } } |