Skip to content

codegen: handle OperandValue::Uninit in codegen_return_terminator#159825

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
glandium:issue159815
Jul 26, 2026
Merged

codegen: handle OperandValue::Uninit in codegen_return_terminator#159825
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
glandium:issue159815

Conversation

@glandium

@glandium glandium commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

View all comments

Fixes #159815.

#157797 added OperandValue::Uninit to skip stores for entirely-uninit constants, but missed the PassMode::Direct | PassMode::Pair branch of codegen_return_terminator, which called immediate_or_packed_pair unconditionally. A function directly returning an all-uninit value (e.g. MaybeUninit::uninit()) would hit that branch and ICE in OperandRef::immediate, as reported against tokio and reduced by tmiasko.

@rustbot rustbot added 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 Jul 24, 2026
@rustbot

rustbot commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

r? @tiif

rustbot has assigned @tiif.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 74 candidates
  • Random selection from 18 candidates

@rustbot

This comment has been minimized.

@glandium

Copy link
Copy Markdown
Contributor Author

r? @oli-obk

@rustbot rustbot assigned oli-obk and unassigned tiif Jul 24, 2026
@rustbot

This comment has been minimized.

Comment thread tests/codegen-llvm/uninit-return-value.rs Outdated
let op = self.codegen_consume(bx, mir::Place::return_place().as_ref());
if let Ref(place_val) = op.val {
bx.load_from_place(bx.backend_type(op.layout), place_val)
} else if let Uninit = op.val {

@oli-obk oli-obk Jul 25, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use an exhaustive match instead of an if let chain

View changes since the review

@oli-obk oli-obk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 25, 2026
@rustbot

rustbot commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

When adding `OperandValue::Uninit` to skip stores for entirely-uninit
constants, we missed the `PassMode::Direct | PassMode::Pair` branch of
`codegen_return_terminator`, which called `immediate_or_packed_pair`
unconditionally. A function directly returning an all-uninit value (e.g.
`MaybeUninit::uninit()`) would hit that branch and ICE in
`OperandRef::immediate`, as reported against tokio and reduced by tmiasko.
@glandium

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 25, 2026
@oli-obk

oli-obk commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 9e9467a has been approved by oli-obk

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 Jul 25, 2026
@Mark-Simulacrum

Copy link
Copy Markdown
Member

@bors p=1

(Since we're getting a non-trivial number of reports of this.)

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 25, 2026
codegen: handle OperandValue::Uninit in codegen_return_terminator

Fixes rust-lang#159815.

rust-lang#157797 added `OperandValue::Uninit` to skip stores for entirely-uninit constants, but missed the `PassMode::Direct | PassMode::Pair` branch of `codegen_return_terminator`, which called `immediate_or_packed_pair` unconditionally. A function directly returning an all-uninit value (e.g. `MaybeUninit::uninit()`) would hit that branch and ICE in `OperandRef::immediate`, as reported against tokio and reduced by tmiasko.
rust-bors Bot pushed a commit that referenced this pull request Jul 25, 2026
codegen: handle OperandValue::Uninit in codegen_return_terminator

Fixes #159815.

#157797 added `OperandValue::Uninit` to skip stores for entirely-uninit constants, but missed the `PassMode::Direct | PassMode::Pair` branch of `codegen_return_terminator`, which called `immediate_or_packed_pair` unconditionally. A function directly returning an all-uninit value (e.g. `MaybeUninit::uninit()`) would hit that branch and ICE in `OperandRef::immediate`, as reported against tokio and reduced by tmiasko.
@rust-bors

This comment has been minimized.

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@bors yield

@rust-bors

rust-bors Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Auto build was cancelled. Cancelled workflows:

The next pull request likely to be tested is #159825.

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 25, 2026
codegen: handle OperandValue::Uninit in codegen_return_terminator

Fixes #159815.

#157797 added `OperandValue::Uninit` to skip stores for entirely-uninit constants, but missed the `PassMode::Direct | PassMode::Pair` branch of `codegen_return_terminator`, which called `immediate_or_packed_pair` unconditionally. A function directly returning an all-uninit value (e.g. `MaybeUninit::uninit()`) would hit that branch and ICE in `OperandRef::immediate`, as reported against tokio and reduced by tmiasko.
@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@bors yield

@rust-bors

rust-bors Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Auto build was cancelled. Cancelled workflows:

The next pull request likely to be tested is #159920.

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 25, 2026
codegen: handle OperandValue::Uninit in codegen_return_terminator

Fixes #159815.

#157797 added `OperandValue::Uninit` to skip stores for entirely-uninit constants, but missed the `PassMode::Direct | PassMode::Pair` branch of `codegen_return_terminator`, which called `immediate_or_packed_pair` unconditionally. A function directly returning an all-uninit value (e.g. `MaybeUninit::uninit()`) would hit that branch and ICE in `OperandRef::immediate`, as reported against tokio and reduced by tmiasko.
@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@bors yield

@rust-bors

rust-bors Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Auto build was cancelled. Cancelled workflows:

The next pull request likely to be tested is #159920.

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 25, 2026
codegen: handle OperandValue::Uninit in codegen_return_terminator

Fixes rust-lang#159815.

rust-lang#157797 added `OperandValue::Uninit` to skip stores for entirely-uninit constants, but missed the `PassMode::Direct | PassMode::Pair` branch of `codegen_return_terminator`, which called `immediate_or_packed_pair` unconditionally. A function directly returning an all-uninit value (e.g. `MaybeUninit::uninit()`) would hit that branch and ICE in `OperandRef::immediate`, as reported against tokio and reduced by tmiasko.
rust-bors Bot pushed a commit that referenced this pull request Jul 25, 2026
…uwer

Rollup of 25 pull requests

Successful merges:

 - #159825 (codegen: handle OperandValue::Uninit in codegen_return_terminator)
 - #138618 (Support using const pointers in asm `const` operand)
 - #157962 (Lower paths to functions in const args as ConstKind::Error)
 - #158404 (trait_solver: normalize next-gen region constraints)
 - #158709 (rustdoc: warn on improperly interleaved HTML/MD)
 - #159174 (Fix implicit_provenance_casts warnings on Xous)
 - #159179 (enable `unreachable_cfg_select_predicates` lint as part of `unused` lint group)
 - #159518 (iter: extend step_by specialization to cover StepBy<RangeIter<{integer}>>)
 - #159673 (bootstrap: forward -fdebug-prefix-map when using cc)
 - #159700 (Split non-local `semicolon_in_expressions_from_macros` into a separate lint)
 - #159720 (document #[global_allocator] constraints)
 - #159732 (optimization: don't look for diagnostic/canonical items without rustc_attrs enabled)
 - #159738 (implement `CovariantUnsafeCell`)
 - #159740 (reuse regular exported_non_generic_symbols logic in Miri)
 - #159780 (check `extern "custom"` function pointers)
 - #159786 (rustdoc-js: ignore editor temp files in test folder discovery)
 - #159819 (std::sync::poison: disable auto_cfg on PoisonError::new)
 - #155388 (stepping into where-clauses during normalization may be productive)
 - #155914 (when bailing on ambiguity, don't force other results to ambig)
 - #159204 (Add support to caller_location to rustc_public)
 - #159439 (Fix(lib/fs/win): Fall back on Win32 delete for `Dir::remove_file`)
 - #159676 (Update wasm-component-ld to 0.5.27)
 - #159695 (proc_macro: Fix cfg_attr inner attrs in file modules)
 - #159730 (allow accessing the contents of UnsafeCell without going through get)
 - #159809 (Avoid `#[target_features]`)
rust-bors Bot pushed a commit that referenced this pull request Jul 25, 2026
…uwer

Rollup of 25 pull requests

Successful merges:

 - #159825 (codegen: handle OperandValue::Uninit in codegen_return_terminator)
 - #138618 (Support using const pointers in asm `const` operand)
 - #157962 (Lower paths to functions in const args as ConstKind::Error)
 - #158404 (trait_solver: normalize next-gen region constraints)
 - #158709 (rustdoc: warn on improperly interleaved HTML/MD)
 - #159174 (Fix implicit_provenance_casts warnings on Xous)
 - #159179 (enable `unreachable_cfg_select_predicates` lint as part of `unused` lint group)
 - #159518 (iter: extend step_by specialization to cover StepBy<RangeIter<{integer}>>)
 - #159673 (bootstrap: forward -fdebug-prefix-map when using cc)
 - #159700 (Split non-local `semicolon_in_expressions_from_macros` into a separate lint)
 - #159720 (document #[global_allocator] constraints)
 - #159732 (optimization: don't look for diagnostic/canonical items without rustc_attrs enabled)
 - #159738 (implement `CovariantUnsafeCell`)
 - #159740 (reuse regular exported_non_generic_symbols logic in Miri)
 - #159780 (check `extern "custom"` function pointers)
 - #159786 (rustdoc-js: ignore editor temp files in test folder discovery)
 - #159819 (std::sync::poison: disable auto_cfg on PoisonError::new)
 - #155388 (stepping into where-clauses during normalization may be productive)
 - #155914 (when bailing on ambiguity, don't force other results to ambig)
 - #159204 (Add support to caller_location to rustc_public)
 - #159439 (Fix(lib/fs/win): Fall back on Win32 delete for `Dir::remove_file`)
 - #159676 (Update wasm-component-ld to 0.5.27)
 - #159695 (proc_macro: Fix cfg_attr inner attrs in file modules)
 - #159730 (allow accessing the contents of UnsafeCell without going through get)
 - #159809 (Avoid `#[target_features]`)
@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@bors p=101
Scheduling

@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 26, 2026
@rust-bors

rust-bors Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: oli-obk
Duration: 3h 11m 36s
Pushing fdbd8ee to main...

@rust-bors
rust-bors Bot merged commit fdbd8ee into rust-lang:main Jul 26, 2026
14 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor
What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 008fa22 (parent) -> fdbd8ee (this PR)

Test differences

Show 6 test diffs

Stage 1

  • [codegen] tests/codegen-llvm/uninit-return-value.rs: [missing] -> pass (J0)

Stage 2

  • [codegen] tests/codegen-llvm/uninit-return-value.rs: [missing] -> pass (J1)

Additionally, 4 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard fdbd8ee70d9b68d98be873e1095d74cf9441f0c8 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-gnu-gcc-core-tests: 8m 10s -> 13m 54s (+70.2%)
  2. optional-x86_64-gnu-parallel-frontend: 1h 34m -> 2h 18m (+46.9%)
  3. x86_64-gnu-llvm-22-1: 51m 36s -> 1h 14m (+44.4%)
  4. x86_64-gnu-next-trait-solver-polonius: 34m 12s -> 46m 33s (+36.1%)
  5. x86_64-msvc-ext1: 1h 38m -> 2h 11m (+33.9%)
  6. x86_64-gnu: 2h 19m -> 1h 37m (-30.4%)
  7. dist-armhf-linux: 1h 10m -> 1h 31m (+30.0%)
  8. dist-x86_64-llvm-mingw: 2h 7m -> 1h 29m (-29.7%)
  9. dist-x86_64-msvc: 2h 23m -> 1h 43m (-28.0%)
  10. dist-i686-msvc: 2h 2m -> 1h 30m (-26.4%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (fdbd8ee): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

Results (primary 1.9%, secondary -2.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.9% [1.9%, 1.9%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.2% [-2.2%, -2.2%] 1
All ❌✅ (primary) 1.9% [1.9%, 1.9%] 1

Cycles

This perf run didn't have relevant results for this metric.

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 489.346s -> 487.865s (-0.30%)
Artifact size: 387.69 MiB -> 387.69 MiB (0.00%)

abbyssoul added a commit to abbyssoul/mdns_sd_discovery that referenced this pull request Jul 26, 2026
The ICE was already reported as rust-lang/rust#159815 and fixed by
rust-lang/rust#159825, merged 2026-07-26 06:29 UTC — after the nightly that
broke us was cut, so 2026-07-27 is the first nightly containing it.

Record that in the pin comment, along with what to check before unpinning, so
the pin does not outlive its cause. rust-lang/rust#159867 is a still-open ICE in
the same `OperandValue::Uninit` family, so the unpin wants verifying rather than
assuming.

Co-Authored-By: Claude Opus 5 <[email protected]>
abbyssoul added a commit to abbyssoul/mdns_sd_discovery that referenced this pull request Jul 26, 2026
The ICE was already reported as rust-lang/rust#159815 and fixed by
rust-lang/rust#159825, merged 2026-07-26 06:29 UTC — after the nightly that
broke us was cut, so 2026-07-27 is the first nightly containing it.

Record that in the pin comment, along with what to check before unpinning, so
the pin does not outlive its cause. rust-lang/rust#159867 is a still-open ICE in
the same `OperandValue::Uninit` family, so the unpin wants verifying rather than
assuming.

Co-Authored-By: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. 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.

[ICE]: thread 'rustc' (2584) panicked at ... compiler/rustc_codegen_ssa/src/mir/operand.rs:291:18:

8 participants