Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes ICE in sparc64 ABI (Issue #115399) #118611

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions compiler/rustc_target/src/abi/call/sparc64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ fn parse_structure<'a, Ty, C>(
cx: &C,
layout: TyAndLayout<'a, Ty>,
mut data: Sdata,
mut offset: Size,
offset: Size,
) -> Sdata
where
Ty: TyAbiInterface<'a, C> + Copy,
Expand All @@ -115,9 +115,15 @@ where
abi::Abi::Aggregate { .. } => {
for i in 0..layout.fields.count() {
if offset < layout.fields.offset(i) {
offset = layout.fields.offset(i);
data = parse_structure(
cx,
layout.field(cx, i),
data.clone(),
layout.fields.offset(i),
);
} else {
data = parse_structure(cx, layout.field(cx, i), data.clone(), offset);
}
data = parse_structure(cx, layout.field(cx, i), data.clone(), offset);
}
}
_ => {
Expand Down
7 changes: 3 additions & 4 deletions tests/ui/abi/compatibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ test_abi_compatible!(fn_fn, fn(), fn(i32) -> i32);

// Compatibility of 1-ZST.
test_abi_compatible!(zst_unit, Zst, ());
#[cfg(not(any(target_arch = "sparc64")))]
test_abi_compatible!(zst_array, Zst, [u8; 0]);
test_abi_compatible!(nonzero_int, NonZeroI32, i32);

Expand Down Expand Up @@ -306,7 +305,7 @@ test_transparent!(zst, Zst);
test_transparent!(unit, ());
test_transparent!(enum_, Option<i32>);
test_transparent!(enum_niched, Option<&'static i32>);
#[cfg(not(any(target_arch = "mips64", target_arch = "sparc64")))]
#[cfg(not(target_arch = "mips64"))]
mod tuples {
use super::*;
// mixing in some floats since they often get special treatment
Expand All @@ -320,7 +319,7 @@ mod tuples {
test_transparent!(tuple, (i32, f32, i64, f64));
}
// Some targets have special rules for arrays.
#[cfg(not(any(target_arch = "mips64", target_arch = "sparc64")))]
#[cfg(not(target_arch = "mips64"))]
mod arrays {
use super::*;
test_transparent!(empty_array, [u32; 0]);
Expand All @@ -342,7 +341,7 @@ macro_rules! test_transparent_unsized {
};
}

#[cfg(not(any(target_arch = "mips64", target_arch = "sparc64")))]
#[cfg(not(target_arch = "mips64"))]
mod unsized_ {
use super::*;
test_transparent_unsized!(str_, str);
Expand Down
Loading