1! PR fortran/69281
2! { dg-do compile }
3! { dg-additional-options "-fstack-arrays -O2" }
4
5program pr69281
6  implicit none
7  call foo1((/ 1, 3, 3, 7 /))
8  call foo2((/ 1, 3, 3, 7 /))
9  call foo3((/ 1, 3, 3, 7 /))
10  call foo4((/ 1, 3, 3, 7 /))
11  call foo5((/ 1, 3, 3, 7 /))
12  call foo6((/ 1, 3, 3, 7 /))
13contains
14  subroutine foo1(x)
15    integer, intent(in) :: x(:)
16    !$omp parallel
17      call baz(bar(x))
18    !$omp end parallel
19  end subroutine
20  subroutine foo2(x)
21    integer, intent(in) :: x(:)
22    !$omp task
23      call baz(bar(x))
24    !$omp end task
25  end subroutine
26  subroutine foo3(x)
27    integer, intent(in) :: x(:)
28    !$omp target
29      call baz(bar(x))
30    !$omp end target
31  end subroutine
32  subroutine foo4(x)
33    integer, intent(in) :: x(:)
34    !$omp target teams
35      call baz(bar(x))
36    !$omp end target teams
37  end subroutine
38  subroutine foo5(x)
39    integer, intent(in) :: x(:)
40    integer :: i
41    !$omp parallel do
42      do i = 1, 1
43        call baz(bar(x))
44      end do
45  end subroutine
46  subroutine foo6(x)
47    integer, intent(in) :: x(:)
48    integer :: i
49    !$omp target teams distribute parallel do
50      do i = 1, 1
51        call baz(bar(x))
52      end do
53  end subroutine
54  function bar(x) result(a)
55    integer, dimension(:), intent(in) :: x
56    integer, dimension(2,size(x)) :: a
57    a(1,:) = 1
58    a(2,:) = x
59  end function
60  subroutine baz(a)
61    integer, dimension(:,:), intent(in) :: a
62  end subroutine
63end program
64