Fix gcc.c-torture/execute/ieee/cdivchkf.c on hpux
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / refcount-1.f90
blobe3b9d04af8138a53ccbfff5033aa3e115c8dc591
1 program main
2 use omp_lib
3 use iso_c_binding
4 implicit none (type, external)
6 integer :: d, id
7 integer(kind=1), target :: a(4)
8 integer(kind=1), pointer :: p, q
10 d = omp_get_default_device ()
11 id = omp_get_initial_device ()
13 if (d < 0 .or. d >= omp_get_num_devices ()) &
14 d = id
16 a = transfer (int(z'cdcdcdcd'), mold=a)
18 !$omp target enter data map (to:a)
20 a = transfer (int(z'abababab'), mold=a)
21 p => a(1)
22 q => a(3)
24 !$omp target enter data map (alloc:p, q)
26 if (d /= id) then
27 if (omp_target_is_present (c_loc(a), d) == 0) &
28 stop 1
29 if (omp_target_is_present (c_loc(p), d) == 0) &
30 stop 2
31 if (omp_target_is_present (c_loc(q), d) == 0) &
32 stop 3
33 end if
35 !$omp target exit data map (release:a)
37 if (d /= id) then
38 if (omp_target_is_present (c_loc(a), d) == 0) &
39 stop 4
40 if (omp_target_is_present (c_loc(p), d) == 0) &
41 stop 5
42 if (omp_target_is_present (c_loc(q), d) == 0) &
43 stop 6
44 end if
46 !$omp target exit data map (from:q)
48 if (d /= id) then
49 if (omp_target_is_present (c_loc(a), d) /= 0) &
50 stop 7
51 if (omp_target_is_present (c_loc(p), d) /= 0) &
52 stop 8
53 if (omp_target_is_present (c_loc(q), d) /= 0) &
54 stop 9
56 if (q /= int(z'cd', kind=1)) &
57 stop 10
58 if (p /= int(z'ab', kind=1)) &
59 stop 11
60 end if
61 end program main