|
| 1 | +! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp |
| 2 | +! OpenMP Version 4.5 |
| 3 | +! 2.15.3.6 Reduction Clause |
| 4 | +program omp_reduction |
| 5 | + integer :: i |
| 6 | + real :: r |
| 7 | + character :: c |
| 8 | + complex :: z |
| 9 | + logical :: l |
| 10 | + |
| 11 | + ! * is allowed for integer, real, and complex |
| 12 | + ! but not for logical or character |
| 13 | + ! ERROR: The type of 'c' is incompatible with the reduction operator. |
| 14 | + ! ERROR: The type of 'l' is incompatible with the reduction operator. |
| 15 | + !$omp parallel reduction(*:i,r,c,z,l) |
| 16 | + !$omp end parallel |
| 17 | + |
| 18 | + ! + is allowed for integer, real, and complex |
| 19 | + ! but not for logical or character |
| 20 | + ! ERROR: The type of 'c' is incompatible with the reduction operator. |
| 21 | + ! ERROR: The type of 'l' is incompatible with the reduction operator. |
| 22 | + !$omp parallel reduction(+:i,r,c,z,l) |
| 23 | + !$omp end parallel |
| 24 | + |
| 25 | + ! - is deprecated for all types |
| 26 | + ! ERROR: The minus reduction operator is deprecated since OpenMP 5.2 and is not supported in the REDUCTION clause. |
| 27 | + !$omp parallel reduction(-:i,r,c,z,l) |
| 28 | + !$omp end parallel |
| 29 | + |
| 30 | + ! .and. is only supported for logical operations |
| 31 | + ! ERROR: The type of 'i' is incompatible with the reduction operator. |
| 32 | + ! ERROR: The type of 'r' is incompatible with the reduction operator. |
| 33 | + ! ERROR: The type of 'c' is incompatible with the reduction operator. |
| 34 | + ! ERROR: The type of 'z' is incompatible with the reduction operator. |
| 35 | + !$omp parallel reduction(.and.:i,r,c,z,l) |
| 36 | + !$omp end parallel |
| 37 | + |
| 38 | + ! .or. is only supported for logical operations |
| 39 | + ! ERROR: The type of 'i' is incompatible with the reduction operator. |
| 40 | + ! ERROR: The type of 'r' is incompatible with the reduction operator. |
| 41 | + ! ERROR: The type of 'c' is incompatible with the reduction operator. |
| 42 | + ! ERROR: The type of 'z' is incompatible with the reduction operator. |
| 43 | + !$omp parallel reduction(.or.:i,r,c,z,l) |
| 44 | + !$omp end parallel |
| 45 | + |
| 46 | + ! .eqv. is only supported for logical operations |
| 47 | + ! ERROR: The type of 'i' is incompatible with the reduction operator. |
| 48 | + ! ERROR: The type of 'r' is incompatible with the reduction operator. |
| 49 | + ! ERROR: The type of 'c' is incompatible with the reduction operator. |
| 50 | + ! ERROR: The type of 'z' is incompatible with the reduction operator. |
| 51 | + !$omp parallel reduction(.eqv.:i,r,c,z,l) |
| 52 | + !$omp end parallel |
| 53 | + |
| 54 | + ! .neqv. is only supported for logical operations |
| 55 | + ! ERROR: The type of 'i' is incompatible with the reduction operator. |
| 56 | + ! ERROR: The type of 'r' is incompatible with the reduction operator. |
| 57 | + ! ERROR: The type of 'c' is incompatible with the reduction operator. |
| 58 | + ! ERROR: The type of 'z' is incompatible with the reduction operator. |
| 59 | + !$omp parallel reduction(.neqv.:i,r,c,z,l) |
| 60 | + !$omp end parallel |
| 61 | + |
| 62 | + ! iand only supports integers |
| 63 | + ! ERROR: The type of 'r' is incompatible with the reduction operator. |
| 64 | + ! ERROR: The type of 'c' is incompatible with the reduction operator. |
| 65 | + ! ERROR: The type of 'z' is incompatible with the reduction operator. |
| 66 | + ! ERROR: The type of 'l' is incompatible with the reduction operator. |
| 67 | + !$omp parallel reduction(iand:i,r,c,z,l) |
| 68 | + !$omp end parallel |
| 69 | + |
| 70 | + ! ior only supports integers |
| 71 | + ! ERROR: The type of 'r' is incompatible with the reduction operator. |
| 72 | + ! ERROR: The type of 'c' is incompatible with the reduction operator. |
| 73 | + ! ERROR: The type of 'z' is incompatible with the reduction operator. |
| 74 | + ! ERROR: The type of 'l' is incompatible with the reduction operator. |
| 75 | + !$omp parallel reduction(ior:i,r,c,z,l) |
| 76 | + !$omp end parallel |
| 77 | + |
| 78 | + ! ieor only supports integers |
| 79 | + ! ERROR: The type of 'r' is incompatible with the reduction operator. |
| 80 | + ! ERROR: The type of 'c' is incompatible with the reduction operator. |
| 81 | + ! ERROR: The type of 'z' is incompatible with the reduction operator. |
| 82 | + ! ERROR: The type of 'l' is incompatible with the reduction operator. |
| 83 | + !$omp parallel reduction(ieor:i,r,c,z,l) |
| 84 | + !$omp end parallel |
| 85 | + |
| 86 | + ! max arguments may be integer, real, or character: |
| 87 | + ! ERROR: The type of 'z' is incompatible with the reduction operator. |
| 88 | + ! ERROR: The type of 'l' is incompatible with the reduction operator. |
| 89 | + !$omp parallel reduction(max:i,r,c,z,l) |
| 90 | + !$omp end parallel |
| 91 | + |
| 92 | + ! min arguments may be integer, real, or character: |
| 93 | + ! ERROR: The type of 'z' is incompatible with the reduction operator. |
| 94 | + ! ERROR: The type of 'l' is incompatible with the reduction operator. |
| 95 | + !$omp parallel reduction(min:i,r,c,z,l) |
| 96 | + !$omp end parallel |
| 97 | +end program omp_reduction |
0 commit comments