| 1 |
! PR middle-end/113904 |
| 2 |
|
| 3 |
module m |
| 4 |
implicit none (type, external) |
| 5 |
logical, parameter :: parameter_true = .false. |
| 6 |
logical :: false_flag = .false. |
| 7 |
integer :: my_dev_num |
| 8 |
contains |
| 9 |
integer function variant1() result(res) |
| 10 |
res = 1 |
| 11 |
end function |
| 12 |
|
| 13 |
integer function variant2() result(res) |
| 14 |
res = 2 |
| 15 |
end function |
| 16 |
|
| 17 |
integer function variant3() result(res) |
| 18 |
res = 3 |
| 19 |
end function |
| 20 |
|
| 21 |
integer function variant4() result(res) |
| 22 |
res = 4 |
| 23 |
end function |
| 24 |
|
| 25 |
integer function variant5() result(res) |
| 26 |
res = 4 |
| 27 |
end function |
| 28 |
|
| 29 |
integer function variant6() result(res) |
| 30 |
res = 4 |
| 31 |
end function |
| 32 |
|
| 33 |
integer function foo() result(res) |
| 34 |
! 'condition' |
| 35 |
!$omp declare variant(variant1) match(user={condition(parameter_true)},construct={teams}) ! OK |
| 36 |
! Below: OK since OpenMP 5.1 - but not yet supported: PR middle-end/113904 |
| 37 |
!$omp declare variant(variant2) match(user={condition(false_flag)},construct={parallel}) ! { dg-error "property must be a constant logical expression" } |
| 38 |
!$omp declare variant(variant3) match(user={condition(1)},construct={target}) ! { dg-error "property must be a constant logical expression" } |
| 39 |
|
| 40 |
! 'device_num' |
| 41 |
!$omp declare variant(variant4) match(target_device={device_num(0)}) ! OK |
| 42 |
!$omp declare variant(variant4) match(target_device={device_num(2)}) ! OK - assuming there are two non-host devices. |
| 43 |
!$omp declare variant(variant5) match(target_device={device_num(-1)}) ! OK - omp_initial_device |
| 44 |
!$omp declare variant(variant5) match(target_device={device_num(-4)}) ! OK - omp_invalid_device (will never match) |
| 45 |
! OK - but not handled -> PR middle-end/113904 |
| 46 |
!$omp declare variant(variant5) match(target_device={device_num(my_device)}) ! { dg-error "property must be a constant integer expression" } |
| 47 |
!$omp declare variant(variant5) match(target_device={device_num(-2)}) ! { dg-error "property must be a conforming device number" } |
| 48 |
|
| 49 |
res = 99 |
| 50 |
end |
| 51 |
end module m |