200 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang -fopenacc2 3! Check OpenACC reduction validity.4 5program openacc_reduction_validity6 implicit none7 8 integer :: i9 real :: r10 complex :: c11 logical :: l12 13 !$acc parallel reduction(+:i)14 !$acc end parallel15 16 !$acc parallel reduction(*:i)17 !$acc end parallel18 19 !$acc parallel reduction(min:i)20 !$acc end parallel21 22 !$acc parallel reduction(max:i)23 !$acc end parallel24 25 !$acc parallel reduction(iand:i)26 !$acc end parallel27 28 !$acc parallel reduction(ior:i)29 !$acc end parallel30 31 !$acc parallel reduction(ieor:i)32 !$acc end parallel33 34 !ERROR: reduction operator not supported for integer type35 !$acc parallel reduction(.and.:i)36 !$acc end parallel37 38 !ERROR: reduction operator not supported for integer type39 !$acc parallel reduction(.or.:i)40 !$acc end parallel41 42 !ERROR: reduction operator not supported for integer type43 !$acc parallel reduction(.eqv.:i)44 !$acc end parallel45 46 !ERROR: reduction operator not supported for integer type47 !$acc parallel reduction(.neqv.:i)48 !$acc end parallel49 50 !$acc parallel reduction(+:r)51 !$acc end parallel52 53 !$acc parallel reduction(*:r)54 !$acc end parallel55 56 !$acc parallel reduction(min:r)57 !$acc end parallel58 59 !$acc parallel reduction(max:r)60 !$acc end parallel61 62 !ERROR: reduction operator not supported for real type63 !$acc parallel reduction(iand:r)64 !$acc end parallel65 66 !ERROR: reduction operator not supported for real type67 !$acc parallel reduction(ior:r)68 !$acc end parallel69 70 !ERROR: reduction operator not supported for real type71 !$acc parallel reduction(ieor:r)72 !$acc end parallel73 74 !ERROR: reduction operator not supported for real type75 !$acc parallel reduction(.and.:r)76 !$acc end parallel77 78 !ERROR: reduction operator not supported for real type79 !$acc parallel reduction(.or.:r)80 !$acc end parallel81 82 !ERROR: reduction operator not supported for real type83 !$acc parallel reduction(.eqv.:r)84 !$acc end parallel85 86 !ERROR: reduction operator not supported for real type87 !$acc parallel reduction(.neqv.:r)88 !$acc end parallel89 90 !$acc parallel reduction(+:c)91 !$acc end parallel92 93 !$acc parallel reduction(*:c)94 !$acc end parallel95 96 !ERROR: reduction operator not supported for complex type97 !$acc parallel reduction(min:c)98 !$acc end parallel99 100 !ERROR: reduction operator not supported for complex type101 !$acc parallel reduction(max:c)102 !$acc end parallel103 104 !ERROR: reduction operator not supported for complex type105 !$acc parallel reduction(iand:c)106 !$acc end parallel107 108 !ERROR: reduction operator not supported for complex type109 !$acc parallel reduction(ior:c)110 !$acc end parallel111 112 !ERROR: reduction operator not supported for complex type113 !$acc parallel reduction(ieor:c)114 !$acc end parallel115 116 !ERROR: reduction operator not supported for complex type117 !$acc parallel reduction(.and.:c)118 !$acc end parallel119 120 !ERROR: reduction operator not supported for complex type121 !$acc parallel reduction(.or.:c)122 !$acc end parallel123 124 !ERROR: reduction operator not supported for complex type125 !$acc parallel reduction(.eqv.:c)126 !$acc end parallel127 128 !ERROR: reduction operator not supported for complex type129 !$acc parallel reduction(.neqv.:c)130 !$acc end parallel131 132 !$acc parallel reduction(.and.:l)133 !$acc end parallel134 135 !$acc parallel reduction(.or.:l)136 !$acc end parallel137 138 !$acc parallel reduction(.eqv.:l)139 !$acc end parallel140 141 !$acc parallel reduction(.neqv.:l)142 !$acc end parallel143 144 !ERROR: reduction operator not supported for logical type145 !$acc parallel reduction(+:l)146 !$acc end parallel147 148 !ERROR: reduction operator not supported for logical type149 !$acc parallel reduction(*:l)150 !$acc end parallel151 152 !ERROR: reduction operator not supported for logical type153 !$acc parallel reduction(min:l)154 !$acc end parallel155 156 !ERROR: reduction operator not supported for logical type157 !$acc parallel reduction(max:l)158 !$acc end parallel159 160 !ERROR: reduction operator not supported for logical type161 !$acc parallel reduction(iand:l)162 !$acc end parallel163 164 !ERROR: reduction operator not supported for logical type165 !$acc parallel reduction(ior:l)166 !$acc end parallel167 168 !ERROR: reduction operator not supported for logical type169 !$acc parallel reduction(ieor:l)170 !$acc end parallel171 172 !ERROR: No explicit type declared for 'xyz'173 !$acc parallel reduction(+:xyz)174 !$acc end parallel 175 176 177end program178 179subroutine sum()180 !ERROR: 'sum' is already declared in this scoping unit181 integer :: i,sum 182 sum = 0183 !$acc parallel184 !ERROR: Only variables are allowed in data clauses on the LOOP directive185 !$acc loop independent gang reduction(+:sum)186 do i=1,10187 sum = sum + i188 enddo189 !$acc end parallel190end subroutine191 192subroutine reduce()193 integer :: red = 0, ii194 !$acc parallel loop default(none) reduction(+:red)195 do ii = 1, 10196 red = red + ii197 end do198 !$acc end parallel199end subroutine200