[flang-commits] [flang] [flang] Add parsing of DO CONCURRENT REDUCE clause (PR #92518)
via flang-commits
flang-commits at lists.llvm.org
Fri May 17 13:45:52 PDT 2024
================
@@ -0,0 +1,89 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! Tests for F'2023 C1132:
+! A variable-name that appears in a REDUCE locality-spec shall be of intrinsic
+! type suitable for the intrinsic operation or function specified by its
+! reduce-operation.
+
+subroutine s1(n)
+! This is OK
+ integer :: i1, i2, i3, i4, i5, i6, i7, n
+ real(8) :: r1, r2, r3, r4
+ complex :: c1, c2
+ logical :: l1, l2, l3(n,n), l4(n)
+ do concurrent(i=1:5) &
+ & reduce(+:i1,r1,c1) reduce(*:i2,r2,c2) reduce(iand:i3) reduce(ieor:i4) &
+ & reduce(ior:i5) reduce(max:i6,r3) reduce(min:i7,r4) reduce(.and.:l1) &
+ & reduce(.or.:l2) reduce(.eqv.:l3) reduce(.neqv.:l4)
+ end do
+end subroutine s1
+
+subroutine s2()
+! Cannot apply logical operations to integer variables
+ integer :: i1, i2, i3, i4
+!ERROR: Reduction variable 'i1' does not have a suitable type.
----------------
khaki3 wrote:
Sure, I will put the list of suitable types.
https://github.com/llvm/llvm-project/pull/92518
More information about the flang-commits
mailing list