Debian Codegraph @

libgomp/testsuite/libgomp.fortran/target-is-initial-device-3.f90

raw
1 ! { dg-additional-options "-fdump-tree-original" }
2 !
3 ! Check that EXPR_EQ works with __builtin_omp_is_initial_device,
4 ! which returns an 'int' while Fortran uses 'logical(4)'.
5 !
6 ! Check that 'call ff (omp_is_initial_device)' accesses the library
7 ! function and not the builtin.
8 !
9 ! { dg-final { scan-tree-dump-times "__builtin_omp_is_initial_device \\(\\)" 14 "original" } } */
10 ! { dg-final { scan-tree-dump "ff \\(omp_is_initial_device\\);" "original" } } */
11 !
12 program main
13 use omp_lib, only: omp_is_initial_device
14 implicit none (type, external)
15
16 logical(1) :: t1
17 logical(2) :: f2
18 t1 = .true.
19 f2 = .false.
20
21 if (omp_is_initial_device () .eqv. .true.) then
22 else
23 stop 1
24 end if
25 if (omp_is_initial_device () .neqv. .true.) stop 2
26 if (omp_is_initial_device () .eqv. .false.) stop 3
27 if (omp_is_initial_device () .neqv. .false.) then
28 else
29 stop 4
30 end if
31
32 if (omp_is_initial_device () .neqv. .true._1) stop 5
33 if (omp_is_initial_device () .eqv. .false._1) stop 6
34 if (omp_is_initial_device () .neqv. .true._2) stop 7
35 if (omp_is_initial_device () .eqv. .false._2) stop 8
36 if (omp_is_initial_device () .neqv. .true._4) stop 9
37 if (omp_is_initial_device () .eqv. .false._4) stop 10
38 if (omp_is_initial_device () .neqv. .true._8) stop 11
39 if (omp_is_initial_device () .eqv. .false._8) stop 12
40
41 if (omp_is_initial_device () .neqv. t1) stop 13
42 if (omp_is_initial_device () .eqv. f2) stop 14
43
44 call ff (omp_is_initial_device)
45 contains
46 subroutine ff(xx)
47 procedure (omp_is_initial_device) :: xx
48 if (.not. xx ()) stop 15
49 end
50 end