Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/CodeGenCUDA/global-initializers.cu
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

52 lines
1.5 KiB
Plaintext

// RUN: %clang_cc1 %s -triple x86_64-linux-unknown -emit-llvm -o - \
// RUN: | FileCheck -check-prefix=HOST %s
// RUN: %clang_cc1 %s -fcuda-is-device \
// RUN: -emit-llvm -o - -triple nvptx64 \
// RUN: -aux-triple x86_64-unknown-linux-gnu | FileCheck \
// RUN: -check-prefix=DEV %s
#include "Inputs/cuda.h"
// Check host/device-based overloding resolution in global variable initializer.
double pow(double, double) { return 1.0; }
__device__ double pow(double, int) { return 2.0; }
// HOST-DAG: call {{.*}}double @_Z3powdd(double noundef 1.000000e+00, double noundef 1.000000e+00)
double X = pow(1.0, 1);
constexpr double cpow(double, double) { return 11.0; }
constexpr __device__ double cpow(double, int) { return 12.0; }
// HOST-DAG: @CX = global double 1.100000e+01
double CX = cpow(11.0, 1);
// DEV-DAG: @CY = addrspace(1) externally_initialized global double 1.200000e+01
__device__ double CY = cpow(12.0, 1);
struct A {
double pow(double, double) { return 3.0; }
__device__ double pow(double, int) { return 4.0; }
};
A a;
// HOST-DAG: call {{.*}}double @_ZN1A3powEdd(ptr {{.*}}@a, double noundef 3.000000e+00, double noundef 1.000000e+00)
double AX = a.pow(3.0, 1);
struct CA {
constexpr double cpow(double, double) const { return 13.0; }
constexpr __device__ double cpow(double, int) const { return 14.0; }
};
const CA ca;
// HOST-DAG: @CAX = global double 1.300000e+01
double CAX = ca.cpow(13.0, 1);
// DEV-DAG: @CAY = addrspace(1) externally_initialized global double 1.400000e+01
__device__ double CAY = ca.cpow(14.0, 1);