codegen: handle OperandValue::Uninit in codegen_return_terminator - #159825
Conversation
|
r? @tiif rustbot has assigned @tiif. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
|
r? @oli-obk |
This comment has been minimized.
This comment has been minimized.
| 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 { |
There was a problem hiding this comment.
Use an exhaustive match instead of an if let chain
|
Reminder, once the PR becomes ready for a review, use |
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.
|
@rustbot ready |
|
@bors r+ rollup |
|
@bors p=1 (Since we're getting a non-trivial number of reports of this.) |
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.
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.
This comment has been minimized.
This comment has been minimized.
|
@bors yield |
|
Auto build was cancelled. Cancelled workflows: The next pull request likely to be tested is #159825. |
This comment has been minimized.
This comment has been minimized.
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.
|
@bors yield |
|
Auto build was cancelled. Cancelled workflows: The next pull request likely to be tested is #159920. |
This comment has been minimized.
This comment has been minimized.
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.
|
@bors yield |
|
Auto build was cancelled. Cancelled workflows: The next pull request likely to be tested is #159920. |
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.
…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]`)
…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]`)
|
@bors p=101 |
This comment has been minimized.
This comment has been minimized.
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 differencesShow 6 test diffsStage 1
Stage 2
Additionally, 4 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard fdbd8ee70d9b68d98be873e1095d74cf9441f0c8 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (fdbd8ee): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis 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.
CyclesThis perf run didn't have relevant results for this metric. Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 489.346s -> 487.865s (-0.30%) |
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
… build (#984) `nix build .#packages.x86_64-linux.bedwars` died in the compiler: ``` error: internal compiler error: compiler/rustc_codegen_ssa/src/mir/operand.rs:291:18: not immediate: OperandRef(Uninit @ TyAndLayout { ty: unsafe_cell::UnsafeCell<MaybeUninit<runtime::task::Notified<Arc<multi_thread::handle::Handle>>>>, ... backend_repr: Scalar(union pointer) ... }) ``` ## What the differentials said The upstream issue carries an 8-line reproduction, which turns a 40-minute `nix build` into a sub-second `rustc` call, so all of these ran against that rather than the workspace. - **Optimisation level.** ICEs at 2 and 3, clean at 0 and 1. So `Tests (ubuntu-latest)` being green proves nothing: it is a debug build and cargoUnit compiles at `-C opt-level=3`. - **Architecture.** Not x86. It ICEs identically on aarch64-apple-darwin, same assertion, same line. The bug is in target-independent `codegen_return_terminator`. - **Nightly.** Clean on 07-23, ICE on 07-24 through 07-26, clean again on 07-27. - **A newer tokio.** Does not exist. 1.53.1 is the newest published. ## The fix Bump the pin forward one day, to the nightly that carries [rust-lang/rust#159825](rust-lang/rust#159825), which fixes [#159815](rust-lang/rust#159815). Root cause upstream: #157797 added `OperandValue::Uninit` and missed the `PassMode::Direct | PassMode::Pair` branch. Forward rather than back, deliberately. Rolling back to 07-23 also works, but it is a knob someone has to remember to remove and it strands the workspace three days behind. Bumping forward becomes an ordinary pin the moment the fix reaches beta. Rejected: `opt-level=1` for tokio only, which permanently deoptimises the async runtime of a game server to work around a compiler bug that is already fixed. ## Verified The whole workspace moves with a toolchain pin, so every gate was re-run. ``` cargo check --workspace --all-targets rc=0 nix run .#lint rc=0 nix run .#test rc=0 447 passed, 1 skipped nix run .#e2e -- --seconds 12 rc=0 3729 LevelChunkWithLight nix build x86_64-linux bedwars + proxy rc=0 ``` ``` /nix/store/rabbfr795mbs20n0qwdmjvlfa3ibprv3-bedwars-0.1.0 /nix/store/qp3ykmwsy35df2hrblaaz77frs6xbjyb-hyperion-proxy-0.1.0 ``` Zero occurrences of `internal compiler error` in the full build log. (sent by an AI agent via Claude Code, model claude-opus-4-6)
View all comments
Fixes #159815.
#157797 added
OperandValue::Uninitto skip stores for entirely-uninit constants, but missed thePassMode::Direct | PassMode::Pairbranch ofcodegen_return_terminator, which calledimmediate_or_packed_pairunconditionally. A function directly returning an all-uninit value (e.g.MaybeUninit::uninit()) would hit that branch and ICE inOperandRef::immediate, as reported against tokio and reduced by tmiasko.