Files
RedBear-OS/local/recipes/dev/libclc/source/flang/test/Semantics/resolve123.f90
T
vasilito cb424d7448 build: static patch-sanity linter (shift-left the malformed-patch class)
verify-patch-sanity.py validates every active recipe .patch has internally-
consistent hunk line counts — catching the 'malformed patch at line N' failure
at commit/CI/preflight time instead of hours into a cook. This cycle hit that
class three times (qtwaylandscanner, sddm, xwayland), each only discovered when
cookbook tried to apply the patch.

Running it across the repo found 29 latent malformed patches (validated against
GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22').
They were harmless only because they sit in vendored recipes (baked, not re-
applied) — but would fail on any version-bump re-derivation. --fix recounts the
hunk headers (body untouched) and repaired all 29.

Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test
(test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats
(empty placeholders, bare-@@ git hunks).
2026-08-01 05:13:02 +03:00

90 lines
2.6 KiB
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
! Tests for F'2023 C1131:
! A variable-name that appears in a REDUCE locality-spec shall not have the
! ASYNCHRONOUS, INTENT (IN), OPTIONAL, or VOLATILE attribute, shall not be
! coindexed, and shall not be an assumed-size array. A variable-name that is not
! permitted to appear in a variable definition context shall not appear in a
! REDUCE locality-spec.
subroutine s1()
! Cannot have ASYNCHRONOUS variable in a REDUCE locality spec
integer, asynchronous :: k
!ERROR: ASYNCHRONOUS variable 'k' not allowed in a REDUCE locality-spec
do concurrent(i=1:5) reduce(+:k)
k = k + i
end do
end subroutine s1
subroutine s2(arg)
! Cannot have a dummy OPTIONAL in a REDUCE locality spec
integer, optional :: arg
!ERROR: OPTIONAL argument 'arg' not allowed in a locality-spec
do concurrent(i=1:5) reduce(*:arg)
arg = arg * 1
end do
end subroutine s2
subroutine s3(arg)
! This is OK
real :: arg
integer :: reduce, reduce2, reduce3
do concurrent(i=1:5) reduce(max:arg,reduce) reduce(iand:reduce2,reduce3)
arg = max(arg, i)
reduce = max(reduce, i)
reduce3 = iand(reduce3, i)
end do
end subroutine s3
subroutine s4(arg)
! Cannot have a dummy INTENT(IN) in a REDUCE locality spec
real, intent(in) :: arg
!ERROR: INTENT IN argument 'arg' not allowed in a locality-spec
do concurrent(i=1:5) reduce(min:arg)
!ERROR: Left-hand side of assignment is not definable
!ERROR: 'arg' is an INTENT(IN) dummy argument
arg = min(arg, i)
end do
end subroutine s4
module m
contains
subroutine s5()
! Cannot have VOLATILE variable in a REDUCE locality spec
integer, volatile :: var
!ERROR: VOLATILE variable 'var' not allowed in a REDUCE locality-spec
do concurrent(i=1:5) reduce(ieor:var)
var = ieor(var, i)
end do
end subroutine s5
subroutine f(x)
integer :: x
end subroutine f
end module m
subroutine s8(arg)
! Cannot have an assumed size array
integer, dimension(*) :: arg
!ERROR: Assumed size array 'arg' not allowed in a locality-spec
do concurrent(i=1:5) reduce(ior:arg)
arg(i) = ior(arg(i), i)
end do
end subroutine s8
subroutine s9()
! Reduction variable should not appear in a variable definition context
integer :: i
!ERROR: 'i' is already declared in this scoping unit
do concurrent(i=1:5) reduce(+:i)
end do
end subroutine s9
subroutine s10()
! Cannot have variable inside of a NAMELIST in a REDUCE locality spec
integer :: k
namelist /nlist1/ k
!ERROR: NAMELIST variable 'k' not allowed in a REDUCE locality-spec
do concurrent(i=1:5) reduce(+:k)
k = k + i
end do
end subroutine s10