Skip to content

Commit 6af8b4f

Browse files
committed
Add large byval align regression
1 parent ae5a759 commit 6af8b4f

3 files changed

Lines changed: 41 additions & 0 deletions

File tree

build_system/tests.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,40 @@ const BASE_SYSROOT_SUITE: &[TestCase] = &[
9292
TestCase::build_bin_and_run("aot.neon", "example/neon.rs", &[]),
9393
TestCase::build_bin_and_run("aot.gen_block_iterate", "example/gen_block_iterate.rs", &[]),
9494
TestCase::build_bin_and_run("aot.raw-dylib", "example/raw-dylib.rs", &[]),
95+
TestCase::custom("aot.large-byval-align", &|runner| {
96+
if !runner.target_compiler.triple.starts_with("x86_64-")
97+
|| runner.target_compiler.triple.contains("windows")
98+
{
99+
eprintln!(
100+
"Skipping large-byval-align: target {} does not hit the backend limit",
101+
runner.target_compiler.triple
102+
);
103+
return;
104+
}
105+
106+
let output = runner
107+
.rustc_command(["example/large-byval-align.rs", "--crate-type", "lib", "-Copt-level=0"])
108+
.output()
109+
.expect("failed to run rustc");
110+
assert!(
111+
!output.status.success(),
112+
"expected large-byval-align.rs to exceed a backend implementation limit"
113+
);
114+
115+
let stderr = String::from_utf8_lossy(&output.stderr);
116+
assert!(
117+
stderr.contains("backend implementation limit exceeded"),
118+
"expected backend implementation limit error, got:\n{stderr}"
119+
);
120+
assert!(
121+
!stderr.contains("internal compiler error"),
122+
"backend implementation limit should not ICE:\n{stderr}"
123+
);
124+
assert!(
125+
!stderr.contains("expected abort due to worker thread errors"),
126+
"worker thread fatal should be reported through diagnostics:\n{stderr}"
127+
);
128+
}),
95129
TestCase::custom("test.sysroot", &|runner| {
96130
apply_patches(
97131
&runner.dirs,

config.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ aot.issue-59326
2424
aot.neon
2525
aot.gen_block_iterate
2626
aot.raw-dylib
27+
aot.large-byval-align
2728
test.sysroot
2829

2930
testsuite.extended_sysroot

example/large-byval-align.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#[allow(dead_code)]
2+
#[repr(align(536870912))]
3+
pub struct A(i64);
4+
5+
#[allow(improper_ctypes_definitions, unused_variables)]
6+
pub extern "C" fn foo(x: A) {}

0 commit comments

Comments
 (0)