Skip to content

Fix PassMode::Cast ABI argument lowering#1659

Open
Kuhai9801 wants to merge 2 commits into
rust-lang:mainfrom
Kuhai9801:fix-cast-abi-padding
Open

Fix PassMode::Cast ABI argument lowering#1659
Kuhai9801 wants to merge 2 commits into
rust-lang:mainfrom
Kuhai9801:fix-cast-abi-padding

Conversation

@Kuhai9801
Copy link
Copy Markdown

@Kuhai9801 Kuhai9801 commented May 31, 2026

Fixes #1477.

Updates PassMode::Cast lowering to pass rounded full ABI units for integer rest fields, matching CastTarget's rounded ABI layout. Casted call arguments now spill Rust-layout storage into an ABI-sized scratch slot before loading ABI parameters, so ABI padding does not cause loads from the wrong representation.

The patch also updates ABI parameter rounding for cast targets. A unit test covers the rounded integer rest case.

Verification:

  • git diff --check
  • cargo fmt --check

Comment thread src/abi/pass_mode.rs Outdated
assert_eq!(params[1].0, Size::from_bytes(8));
assert_eq!(params[1].1.value_type, types::I64);
}
}
Copy link
Copy Markdown
Member

@bjorn3 bjorn3 May 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't run unit tests.

View changes since the review

@bjorn3
Copy link
Copy Markdown
Member

bjorn3 commented May 31, 2026

It would be nice if we had a concrete test for a case that goes wrong without this change.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 31, 2026

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (NB. this repo may be misconfigured) some time within the next two weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apply fixes from "https://github.com/rust-lang/rust/pull/122619" to cg_clif

3 participants