Skip to content

Fix PassMode::Cast ABI argument lowering#1659

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

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

Conversation

@1sgtpepper

@1sgtpepper 1sgtpepper commented May 31, 2026

Copy link
Copy Markdown

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

@1sgtpepper 1sgtpepper force-pushed the fix-cast-abi-padding branch 2 times, most recently from c8ed51a to c15ab15 Compare May 31, 2026 14:53
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);
}
}

@bjorn3 bjorn3 May 31, 2026

Copy link
Copy Markdown
Member

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

bjorn3 commented May 31, 2026

Copy link
Copy Markdown
Member

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

@1sgtpepper 1sgtpepper force-pushed the fix-cast-abi-padding branch from c15ab15 to d3c9ff1 Compare May 31, 2026 15:10
@1sgtpepper 1sgtpepper force-pushed the fix-cast-abi-padding branch from d3c9ff1 to 5e8d47a Compare May 31, 2026 15:20
@1sgtpepper 1sgtpepper marked this pull request as ready for review May 31, 2026 17:44
@rustbot

This comment was marked as outdated.

@rustbot

rustbot commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (possibly 604d40f) made this pull request unmergeable. Please resolve the merge conflicts.

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