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

96 lines
2.0 KiB
FortranFixed

! RUN: %flang_fc1 -fsyntax-only -fopenacc %s 2>&1
C Test file for OpenACC directives in fixed-form Fortran
PROGRAM ACCTEST
IMPLICIT NONE
INTEGER :: N, I, J
PARAMETER (N=100)
REAL :: A(N), B(N), C(N), D(N)
REAL :: SUM
C Initialize arrays
DO I = 1, N
A(I) = I * 1.0
B(I) = I * 2.0
C(I) = 0.0
D(I) = 1.0
END DO
C Basic data construct using C$ACC
C$ACC DATA COPYIN(A,B) COPYOUT(C)
DO I = 1, N
C(I) = A(I) + B(I)
END DO
C$ACC END DATA
* Parallel construct with loop using *$ACC
*$ACC PARALLEL PRESENT(A,B,C)
*$ACC LOOP
DO I = 1, N
C(I) = C(I) * 2.0
END DO
*$ACC END PARALLEL
C Nested loops with collapse - C$ACC style
C$ACC PARALLEL LOOP COLLAPSE(2)
DO I = 1, N
DO J = 1, N
A(J) = A(J) + B(J)
END DO
END DO
C$ACC END PARALLEL LOOP
* Combined parallel loop with reduction - *$ACC style
SUM = 0.0
*$ACC PARALLEL LOOP REDUCTION(+:SUM)
DO I = 1, N
SUM = SUM + C(I)
END DO
*$ACC END PARALLEL LOOP
C Kernels construct - C$ACC with continuation
C$ACC KERNELS
C$ACC+ COPYOUT(A)
DO I = 1, N
A(I) = A(I) * 2.0
END DO
C$ACC END KERNELS
* Data construct with update - *$ACC with continuation
*$ACC DATA COPY(B)
*$ACC+ PRESENT(D)
B(1) = 999.0
*$ACC UPDATE HOST(B(1:1))
PRINT *, 'B(1) = ', B(1)
*$ACC END DATA
C Mixed style directives in nested constructs
C$ACC DATA COPY(A,B,C)
*$ACC PARALLEL LOOP
DO I = 1, N
A(I) = B(I) + C(I)
END DO
*$ACC END PARALLEL LOOP
C$ACC END DATA
* Subroutine call within data region - *$ACC style
*$ACC DATA COPY(A,B,C)
CALL SUB1(A, B, C, N)
*$ACC END DATA
PRINT *, 'Sum = ', SUM
END PROGRAM
C Subroutine with mixed ACC directive styles
SUBROUTINE SUB1(X, Y, Z, M)
INTEGER M, I
REAL X(M), Y(M), Z(M)
*$ACC PARALLEL PRESENT(X,Y)
C$ACC LOOP PRIVATE(I)
DO I = 1, M
Z(I) = X(I) + Y(I)
END DO
C$ACC END LOOP
*$ACC END PARALLEL
RETURN
END SUBROUTINE