Skip to content

c-variadic: fix for sparc64#155660

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
folkertdev:sparc64-c-variadic
Apr 24, 2026
Merged

c-variadic: fix for sparc64#155660
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
folkertdev:sparc64-c-variadic

Conversation

@folkertdev
Copy link
Copy Markdown
Contributor

@folkertdev folkertdev commented Apr 22, 2026

tracking issue: #44930

Turns out it's a big-endian target that right-adjusts values in the stack slots.

Apparently these tests do get run occasionally, though i don't think test failures are usually turned into issues on this repo. I guess we could add an assembly test here too, though really you just have to run these tests. I've tried this locally with qemu, and it passes all c-variadic tests.

cc @thejpster @glaubitz
r? tgross35

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 22, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 22, 2026

tgross35 is currently at their maximum review capacity.
They may take a while to respond.

Copy link
Copy Markdown
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

Thanks for adding the docs. This makes sense to me, but similar to #152576 (and others) it would be good to have a regression test. Can probably just be based on top of that PR to reuse the test case.

View changes since this review

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 23, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@folkertdev folkertdev added the F-c_variadic `#![feature(c_variadic)]` label Apr 23, 2026
pub const unsafe fn va_arg<T: VaArgSafe>(ap: &mut VaList<'_>) -> T;

#[unsafe(no_mangle)]
unsafe extern "C" fn read_f64(ap: &mut VaList<'_>) -> f64 {
Copy link
Copy Markdown
Contributor Author

@folkertdev folkertdev Apr 23, 2026

Choose a reason for hiding this comment

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

I verified this with https://godbolt.org/z/qrM37rY6n and we match it exactly.

Interestingly using LLVM IR directly will miscompile va_arg.

View changes since the review

Copy link
Copy Markdown
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 23, 2026

📌 Commit 7970597 has been approved by tgross35

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 23, 2026
rust-bors Bot pushed a commit that referenced this pull request Apr 24, 2026
Rollup of 7 pull requests

Successful merges:

 - #155660 (c-variadic: fix for sparc64)
 - #153482 (tests/ui/macros: add annotations for reference rules)
 - #155075 (Add docs about SDKs and C compilation on armv7a-vex-v5)
 - #155685 (Fix `get_child_at_index` return type hints)
 - #155686 (Fix array template arg lookup behavior)
 - #155689 (Const initialize `LOCK_LATCH` thread local)
 - #155690 (Fix classify_union to return Union for regular unions)
@rust-bors rust-bors Bot merged commit 85468d1 into rust-lang:main Apr 24, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 24, 2026
rust-timer added a commit that referenced this pull request Apr 24, 2026
Rollup merge of #155660 - folkertdev:sparc64-c-variadic, r=tgross35

c-variadic: fix for sparc64

tracking issue: #44930

Turns out it's a big-endian target that right-adjusts values in the stack slots.

Apparently these tests do get run occasionally, though i don't think test failures are usually turned into issues on this repo. I guess we could add an assembly test here too, though really you just have to run these tests. I've tried this locally with qemu, and it passes all c-variadic tests.

cc @thejpster @glaubitz
r? tgross35
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Apr 24, 2026
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#155660 (c-variadic: fix for sparc64)
 - rust-lang/rust#153482 (tests/ui/macros: add annotations for reference rules)
 - rust-lang/rust#155075 (Add docs about SDKs and C compilation on armv7a-vex-v5)
 - rust-lang/rust#155685 (Fix `get_child_at_index` return type hints)
 - rust-lang/rust#155686 (Fix array template arg lookup behavior)
 - rust-lang/rust#155689 (Const initialize `LOCK_LATCH` thread local)
 - rust-lang/rust#155690 (Fix classify_union to return Union for regular unions)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. F-c_variadic `#![feature(c_variadic)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants