Files
RedBear-OS/local/recipes/dev/libclc/source/flang/test/Semantics/data03.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

93 lines
2.9 KiB
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
!Testing data constraints : C874 - C875, C878 - C881
module m
integer, target :: modarray(1)
contains
function f(i)
integer, intent(in) :: i
integer, pointer :: f
f => modarray(i)
end
subroutine CheckObject
type specialNumbers
integer one
integer numbers(5)
end type
type large
integer elt(10)
integer val
type(specialNumbers) nums
type(specialNumbers) numsArray(5)
end type
type(specialNumbers), parameter ::newNums = &
specialNumbers(1, (/ 1, 2, 3, 4, 5 /))
type(specialNumbers), parameter ::newNumsArray(2) = &
(/ SpecialNumbers(1, (/ 1, 2, 3, 4, 5 /)), &
SpecialNumbers(1, (/ 1, 2, 3,4, 5 /)) /)
type(specialNumbers) nums
type(large) largeArray(5)
type(large) largeNumber
real :: a[*]
real :: b(5)
integer :: x
real, parameter:: c(5) = (/ 1, 2, 3, 4, 5 /)
integer :: d(10, 10)
character :: name(12)
integer :: ind = 2
!ERROR: Data statement object must be a variable
DATA name%len / 666 /
!C874
!ERROR: Data object must not be a coindexed variable
DATA a[1] / 1 /
!C874
!ERROR: Data object must not be a coindexed variable
DATA(a[i], i = 1, 5) / 5 * 1 /
!C875
!ERROR: Data object variable must not be a function reference
DATA f(1) / 1 /
!C875
!ERROR: Data object must have constant subscripts
DATA b(ind) / 1 /
!C875
!ERROR: Data object must have constant subscripts
DATA name( : ind) / 'Ancd' /
!C875
!ERROR: Data object must have constant subscripts
DATA name(ind:) / 'Ancd' /
!C878
!ERROR: Data implied do object must be a variable
DATA(c(i), i = 1, 5) / 5 * 1 /
!C878
!ERROR: Data implied do object must be a variable
DATA(newNumsArray(i), i = 1, 2) &
/ specialNumbers(1, 2 * (/ 1, 2, 3, 4, 5 /)) /
!C880
!ERROR: Data implied do structure component must be subscripted
DATA(nums % one, i = 1, 5) / 5 * 1 /
!C879
!ERROR: Data implied do object must be a variable
DATA(newNums % numbers(i), i = 1, 5) / 5 * 1 /
!C879
!ERROR: Data implied do object must be a variable
DATA(newNumsArray(i) % one, i = 1, 5) / 5 * 1 /
!C880
!OK: Correct use
DATA(largeArray(j) % nums % one, j = 1, 5) / 5 * 1 /
!C880
!OK: Correct use
DATA(largeNumber % numsArray(j) % one, j = 1, 5) / 5 * 1 /
!C881
!ERROR: Data object must have constant subscripts
DATA(b(x), i = 1, 5) / 5 * 1 /
!C881
!OK: Correct use
DATA(nums % numbers(i), i = 1, 5) / 5 * 1 /
!C881
!OK: Correct use
DATA((d(i, j), i = 1, 10), j = 1, 10) / 100 * 1 /
!C881
!OK: Correct use
DATA(d(i, 1), i = 1, 10) / 10 * 1 /
end
end