Debian Codegraph @

gcc/testsuite/gfortran.dg/gomp/imperfect2.f90

raw
1 ! This test case is expected to fail due to errors.
2
3 ! Note that the calls to these functions in the test case don't make
4 ! any sense in terms of behavior, they're just there to test the error
5 ! behavior.
6
7 module omp_lib
8 use iso_c_binding
9 interface
10 integer function omp_get_thread_num ()
11 end
12 subroutine omp_set_max_levels (i)
13 integer :: i
14 end
15 end interface
16 end module
17
18 program junk
19 use omp_lib
20 implicit none
21
22 contains
23
24 subroutine f1 (depth, iter)
25 integer :: depth, iter
26 end subroutine
27
28 subroutine f2 (depth, iter)
29 integer :: depth, iter
30 end subroutine
31
32 subroutine s1 (a1, a2, a3)
33 integer :: a1, a2, a3
34 integer :: i, j, k
35
36 integer :: m
37
38 !$omp do collapse(3)
39 do i = 1, a1
40 call f1 (1, i)
41 m = omp_get_thread_num () ! { dg-error "OpenMP API call in intervening code" }
42 do j = 1, a2 + omp_get_thread_num () ! This is OK
43 call f1 (2, j)
44 do k = 1, a3
45 call f1 (m, k)
46 call omp_set_max_active_levels (k) ! This is OK too
47 call f2 (m, k)
48 end do
49 call f2 (2, j)
50 call omp_set_max_active_levels (i) ! { dg-error "OpenMP API call in intervening code" }
51 end do
52 call f2 (1, i)
53 end do
54 end subroutine
55
56 end program