brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 8f7c3ac Raw
90 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Tests for F'2023 C1131:3! A variable-name that appears in a REDUCE locality-spec shall not have the4! ASYNCHRONOUS, INTENT (IN), OPTIONAL, or VOLATILE attribute, shall not be5! coindexed, and shall not be an assumed-size array. A variable-name that is not6! permitted to appear in a variable definition context shall not appear in a7! REDUCE locality-spec.8 9subroutine s1()10! Cannot have ASYNCHRONOUS variable in a REDUCE locality spec11  integer, asynchronous :: k12!ERROR: ASYNCHRONOUS variable 'k' not allowed in a REDUCE locality-spec13  do concurrent(i=1:5) reduce(+:k)14     k = k + i15  end do16end subroutine s117 18subroutine s2(arg)19! Cannot have a dummy OPTIONAL in a REDUCE locality spec20  integer, optional :: arg21!ERROR: OPTIONAL argument 'arg' not allowed in a locality-spec22  do concurrent(i=1:5) reduce(*:arg)23     arg = arg * 124  end do25end subroutine s226 27subroutine s3(arg)28! This is OK29  real :: arg30  integer :: reduce, reduce2, reduce331  do concurrent(i=1:5) reduce(max:arg,reduce) reduce(iand:reduce2,reduce3)32     arg = max(arg, i)33     reduce = max(reduce, i)34     reduce3 = iand(reduce3, i)35  end do36end subroutine s337 38subroutine s4(arg)39! Cannot have a dummy INTENT(IN) in a REDUCE locality spec40  real, intent(in) :: arg41!ERROR: INTENT IN argument 'arg' not allowed in a locality-spec42  do concurrent(i=1:5) reduce(min:arg)43!ERROR: Left-hand side of assignment is not definable44!ERROR: 'arg' is an INTENT(IN) dummy argument45     arg = min(arg, i)46  end do47end subroutine s448 49module m50contains51  subroutine s5()52    ! Cannot have VOLATILE variable in a REDUCE locality spec53    integer, volatile :: var54    !ERROR: VOLATILE variable 'var' not allowed in a REDUCE locality-spec55    do concurrent(i=1:5) reduce(ieor:var)56       var = ieor(var, i)57    end do58  end subroutine s559  subroutine f(x)60    integer :: x61  end subroutine f62end module m63 64subroutine s8(arg)65! Cannot have an assumed size array66  integer, dimension(*) :: arg67!ERROR: Assumed size array 'arg' not allowed in a locality-spec68  do concurrent(i=1:5) reduce(ior:arg)69     arg(i) = ior(arg(i), i)70  end do71end subroutine s872 73subroutine s9()74! Reduction variable should not appear in a variable definition context75  integer :: i76!ERROR: 'i' is already declared in this scoping unit77  do concurrent(i=1:5) reduce(+:i)78  end do79end subroutine s980 81subroutine s10()82! Cannot have variable inside of a NAMELIST in a REDUCE locality spec83  integer :: k84  namelist /nlist1/ k85!ERROR: NAMELIST variable 'k' not allowed in a REDUCE locality-spec86  do concurrent(i=1:5) reduce(+:k)87     k = k + i88  end do89end subroutine s1090