1 |
694 |
jeremybenn |
! { dg-do compile }
|
2 |
|
|
! { dg-options "-fcoarray=lib -fdump-tree-original" }
|
3 |
|
|
!
|
4 |
|
|
! Check argument passing with assumed-shape coarray dummies
|
5 |
|
|
!
|
6 |
|
|
program test_caf
|
7 |
|
|
implicit none
|
8 |
|
|
integer, allocatable :: A(:)[:]
|
9 |
|
|
integer, save :: B(3)[*]
|
10 |
|
|
integer :: i
|
11 |
|
|
|
12 |
|
|
allocate (A(3)[*])
|
13 |
|
|
A = [1, 2, 3 ]
|
14 |
|
|
B = [9, 7, 4 ]
|
15 |
|
|
call foo (A, A, test=1)
|
16 |
|
|
call foo (A(2:3), B, test=2)
|
17 |
|
|
call foo (B, A, test=3)
|
18 |
|
|
contains
|
19 |
|
|
subroutine foo(x, y, test)
|
20 |
|
|
integer :: x(:)[*]
|
21 |
|
|
integer, contiguous :: y(:)[*]
|
22 |
|
|
integer :: test
|
23 |
|
|
call bar (x)
|
24 |
|
|
call expl (y)
|
25 |
|
|
end subroutine foo
|
26 |
|
|
|
27 |
|
|
subroutine bar(y)
|
28 |
|
|
integer :: y(:)[*]
|
29 |
|
|
end subroutine bar
|
30 |
|
|
|
31 |
|
|
subroutine expl(z)
|
32 |
|
|
integer :: z(*)[*]
|
33 |
|
|
end subroutine expl
|
34 |
|
|
end program test_caf
|
35 |
|
|
|
36 |
|
|
! { dg-final { scan-tree-dump-times "expl \\(integer\\(kind=4\\).0:. . restrict z, void . restrict caf_token.\[0-9\]+, integer\\(kind=.\\) caf_offset.\[0-9\]+\\)" 1 "original" } }
|
37 |
|
|
!
|
38 |
|
|
! { dg-final { scan-tree-dump-times "bar \\(struct array2_integer\\(kind=4\\) & restrict y, void . restrict caf_token.\[0-9\]+, integer\\(kind=.\\) caf_offset.\[0-9\]+\\)" 1 "original" } }
|
39 |
|
|
!
|
40 |
|
|
! { dg-final { scan-tree-dump-times "foo \\(struct array2_integer\\(kind=4\\) & restrict x, struct array2_integer\\(kind=4\\) & restrict y, integer\\(kind=4\\) & restrict test, void . restrict caf_token.\[0-9\]+, integer\\(kind=.\\) caf_offset.\[0-9\]+, void . restrict caf_token.\[0-9\]+, integer\\(kind=.\\) caf_offset.\[0-9\]+\\)" 1 "original" } }
|
41 |
|
|
!
|
42 |
|
|
! { dg-final { scan-tree-dump-times "bar \\(&parm.\[0-9\]+, caf_token.\[0-9\]+, \\(\\(integer\\(kind=.\\)\\) parm.\[0-9\]+.data - \\(integer\\(kind=.\\)\\) x.\[0-9\]+\\) \\+ caf_offset.\[0-9\]+\\);" 1 "original" } }
|
43 |
|
|
! { d_g-final { scan-tree-dump-times "bar \\(&parm.\[0-9\]+, caf_token.\[0-9\]+, \\(\\(integer\\(kind=.\\) parm.\[0-9\]+.data - \\(integer\\(kind=.\\)\\) x.\[0-9\]+\\) \\+ caf_offset.\[0-9\]+\\);" 1 "original" } }
|
44 |
|
|
!
|
45 |
|
|
! { dg-final { scan-tree-dump-times "expl \\(\\(integer\\(kind=4\\).0:. .\\) parm.\[0-9\]+.data, caf_token.\[0-9\]+, \\(\\(integer\\(kind=.\\)\\) parm.\[0-9\]+.data - \\(\\(integer\\(kind=.\\)\\) y.\[0-9\]+\\) \\+ caf_offset.\[0-9\]+\\);" 0 "original" } }
|
46 |
|
|
!
|
47 |
|
|
! { dg-final { scan-tree-dump-times "foo \\(&a, &a, &C.\[0-9\]+, a.token, 0, a.token, 0\\);" 1 "original" } }
|
48 |
|
|
!
|
49 |
|
|
! { dg-final { scan-tree-dump-times "foo \\(&parm.\[0-9\]+, &parm.\[0-9\]+, &C.\[0-9\]+, a.token, \\(integer\\(kind=.\\)\\) parm.\[0-9\]+.data - \\(integer\\(kind=.\\)\\) a.data, caf_token.\[0-9\]+, \\(integer\\(kind=.\\)\\) parm.\[0-9\]+.data - \\(integer\\(kind=.\\)\\) b\\);" 1 "original" } }
|
50 |
|
|
!
|
51 |
|
|
! { dg-final { scan-tree-dump-times "foo \\(&parm.\[0-9\]+, &a, &C.\[0-9\]+, caf_token.\[0-9\]+, \\(integer\\(kind=.\\)\\) parm.\[0-9\]+.data - \\(integer\\(kind=.\\)\\) b, a.token, 0\\);" 1 "original" } }
|
52 |
|
|
!
|
53 |
|
|
! { dg-final { cleanup-tree-dump "original" } }
|