cb424d7448
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).
50 lines
2.9 KiB
Plaintext
50 lines
2.9 KiB
Plaintext
// Test fir.box_offset code generation.
|
|
// RUN: tco %s | FileCheck %s
|
|
// RUN: %flang_fc1 -emit-llvm %s -o - | FileCheck %s
|
|
|
|
func.func @scalar_addr(%scalar : !fir.ref<!fir.box<!fir.type<t>>>) -> !fir.llvm_ptr<!fir.ref<!fir.type<t>>> {
|
|
%addr = fir.box_offset %scalar base_addr : (!fir.ref<!fir.box<!fir.type<t>>>) -> !fir.llvm_ptr<!fir.ref<!fir.type<t>>>
|
|
return %addr : !fir.llvm_ptr<!fir.ref<!fir.type<t>>>
|
|
}
|
|
// CHECK-LABEL: define ptr @scalar_addr(
|
|
// CHECK-SAME: ptr {{[^%]*}}%[[BOX:.*]]){{.*}}{
|
|
// CHECK: %[[VAL_0:.*]] = getelementptr { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }, ptr %[[BOX]], i32 0, i32 0
|
|
// CHECK: ret ptr %[[VAL_0]]
|
|
|
|
func.func @scalar_tdesc(%scalar : !fir.ref<!fir.box<!fir.type<t>>>) -> !fir.llvm_ptr<!fir.tdesc<!fir.type<t>>> {
|
|
%tdesc = fir.box_offset %scalar derived_type : (!fir.ref<!fir.box<!fir.type<t>>>) -> !fir.llvm_ptr<!fir.tdesc<!fir.type<t>>>
|
|
return %tdesc : !fir.llvm_ptr<!fir.tdesc<!fir.type<t>>>
|
|
}
|
|
// CHECK-LABEL: define ptr @scalar_tdesc(
|
|
// CHECK-SAME: ptr {{[^%]*}}%[[BOX:.*]]){{.*}}{
|
|
// CHECK: %[[VAL_0:.*]] = getelementptr { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }, ptr %[[BOX]], i32 0, i32 7
|
|
// CHECK: ret ptr %[[VAL_0]]
|
|
|
|
func.func @array_addr(%array : !fir.ref<!fir.class<!fir.ptr<!fir.array<?x!fir.type<t>>>>>) -> !fir.llvm_ptr<!fir.ptr<!fir.array<?x!fir.type<t>>>> {
|
|
%addr = fir.box_offset %array base_addr : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?x!fir.type<t>>>>>) -> !fir.llvm_ptr<!fir.ptr<!fir.array<?x!fir.type<t>>>>
|
|
return %addr : !fir.llvm_ptr<!fir.ptr<!fir.array<?x!fir.type<t>>>>
|
|
}
|
|
// CHECK-LABEL: define ptr @array_addr(
|
|
// CHECK-SAME: ptr {{[^%]*}}%[[BOX:.*]]){{.*}}{
|
|
// CHECK: %[[VAL_0:.*]] = getelementptr { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]], ptr, [1 x i64] }, ptr %[[BOX]], i32 0, i32 0
|
|
// CHECK: ret ptr %[[VAL_0]]
|
|
|
|
func.func @array_tdesc(%array : !fir.ref<!fir.class<!fir.ptr<!fir.array<?x!fir.type<t>>>>>) -> !fir.llvm_ptr<!fir.tdesc<!fir.type<t>>> {
|
|
%tdesc = fir.box_offset %array derived_type : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?x!fir.type<t>>>>>) -> !fir.llvm_ptr<!fir.tdesc<!fir.type<t>>>
|
|
return %tdesc : !fir.llvm_ptr<!fir.tdesc<!fir.type<t>>>
|
|
}
|
|
// CHECK-LABEL: define ptr @array_tdesc(
|
|
// CHECK-SAME: ptr {{[^%]*}}%[[BOX:.*]]){{.*}}{
|
|
// CHECK: %[[VAL_0:.*]] = getelementptr { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]], ptr, [1 x i64] }, ptr %[[BOX]], i32 0, i32 8
|
|
// CHECK: ret ptr %[[VAL_0]]
|
|
|
|
func.func @boxchar_addr(%boxchar : !fir.ref<!fir.boxchar<1>>) -> !fir.llvm_ptr<!fir.ref<!fir.char<1,?>>> {
|
|
%addr = fir.box_offset %boxchar base_addr : (!fir.ref<!fir.boxchar<1>>) -> !fir.llvm_ptr<!fir.ref<!fir.char<1,?>>>
|
|
return %addr : !fir.llvm_ptr<!fir.ref<!fir.char<1,?>>>
|
|
}
|
|
|
|
// CHECK-LABEL: define ptr @boxchar_addr(
|
|
// CHECK-SAME: ptr {{.*}}%[[BOXCHAR:.*]]){{.*}} {
|
|
// CHECK: %[[VAL_0:.*]] = getelementptr { ptr, i64 }, ptr %[[BOXCHAR]], i32 0, i32 0
|
|
// CHECK: ret ptr %[[VAL_0]]
|