Files
RedBear-OS/local/recipes/dev/libclc/source/flang/test/Lower/variable-common-viewed-as-module-var.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

38 lines
1.2 KiB
Fortran

! RUN: bbc -emit-hlfir %s -o - | FileCheck %s
! Test non standard definition of a common block as a BIND(C) variable.
! This happens when MPI and MPI_F08 are used inside the same compilation
! unit because MPI uses common blocks while MPI_F08 uses BIND(C) variables
! to refer to the same objects (e.g. mpi_argv_null).
module m_common_var
character(1) :: var
common /var_storage/var
end module
module m_bindc_var
character(1), bind(c, name="var_storage_") :: var
end module
subroutine s1()
use m_common_var, only : var
var = "a"
end subroutine
subroutine s2()
use m_bindc_var, only : var
print *, var
end subroutine
call s1()
call s2()
end
! CHECK: fir.global common @var_storage_(dense<0> : vector<1xi8>) {alignment = 1 : i64} : !fir.array<1xi8>
! CHECK-LABEL: func.func @_QPs1
! CHECK: hlfir.declare %{{.*}} typeparams %c1 {uniq_name = "_QMm_common_varEvar"} : (!fir.ref<!fir.char<1>>, index) -> (!fir.ref<!fir.char<1>>, !fir.ref<!fir.char<1>>)
! CHECK-LABEL: func.func @_QPs2
! CHECK: hlfir.declare %{{.*}} typeparams %c1 {fortran_attrs = #fir.var_attrs<bind_c>, uniq_name = "var_storage_"} : (!fir.ref<!fir.char<1>>, index) -> (!fir.ref<!fir.char<1>>, !fir.ref<!fir.char<1>>)