Skip to content

Add regression test for asm register exhaustion crash#152523

Open
yashhzd wants to merge 1 commit intorust-lang:mainfrom
yashhzd:test/asm-register-exhaustion
Open

Add regression test for asm register exhaustion crash#152523
yashhzd wants to merge 1 commit intorust-lang:mainfrom
yashhzd:test/asm-register-exhaustion

Conversation

@yashhzd
Copy link

@yashhzd yashhzd commented Feb 12, 2026

Regression test for #90815 — requesting more registers than available in inline assembly should produce a clean error, not a SIGSEGV.

Uses the original reproducer code adapted to minicore test infrastructure.

Closes #90815

@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 Feb 12, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 12, 2026

r? @nnethercote

rustbot has assigned @nnethercote.
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 67 candidates
  • Random selection from 16 candidates

@rustbot

This comment has been minimized.

@chenyukang
Copy link
Member

chenyukang commented Feb 12, 2026

Out of curiosity, the PR description is from LLM?
seems too verbose.

@rust-log-analyzer

This comment has been minimized.

@nnethercote
Copy link
Contributor

@yashhzd: What prompted you to look at #90815? This appears to be your first PR for Rust. In fact, looking at your GitHub history, you had one contribution for all of 2024-2026 prior to today, and 16 contributions across multiple repositories. This is a highly unusual contribution pattern.

@yashhzd
Copy link
Author

yashhzd commented Feb 12, 2026

Hey, I'm a student getting into open source for GSoC prep and was going through E-easy labeled issues. Picked this one since it seemed straightforward - a regression test for a fixed crash.

I should've set up a local cross-compilation toolchain before submitting though, the CI failures are on me. I can fix the .stderr file if you'd like, or happy to close this if it's not worth the review effort. Let me know either way.

@Kivooeo
Copy link
Member

Kivooeo commented Feb 12, 2026

yes, update the stderr

just dont use llm to generate the pr description next time

@nnethercote
Copy link
Contributor

Thanks for the explanation. There's been a huge uptick of low-quality PR submissions using LLMs lately, so we are having to be much more on guard about such things. The "Test Details" section of the PR description in particular is very LLM-y, extraneous information that just recapitulates the code changes.

The original test in #90815 would avoid the "argument never used" warnings, I think. Also I like the variable names r1..r15 better than a..p. So I suggest reusing that code verbatim.

@reddevilmidzy
Copy link
Member

@rustbot author

@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 Feb 15, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 15, 2026

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

@rustbot

This comment has been minimized.

@yashhzd
Copy link
Author

yashhzd commented Feb 16, 2026

Updated — switched to the original reproducer code from #90815 (r0..r15 variables, mov instructions). This should fix the check phase failure since all asm operands are now referenced in the template.

Will add the .stderr once CI shows the exact output — no ARM cross-compile setup locally.

Cleaned up the PR description too, sorry about the verbosity.

@yashhzd yashhzd force-pushed the test/asm-register-exhaustion branch from 5eea8cf to d8b6ce3 Compare February 16, 2026 10:26
@rust-log-analyzer

This comment has been minimized.

@yashhzd yashhzd force-pushed the test/asm-register-exhaustion branch from 36e249b to 51e689e Compare February 16, 2026 11:02
@yashhzd
Copy link
Author

yashhzd commented Feb 16, 2026

Added the .stderr file from the CI output. Also squashed into a single commit with no issue links in the message. Waiting on CI now.

@rust-log-analyzer

This comment has been minimized.

Adapt the original reproducer to minicore test infrastructure:
use r0..r15 variable names with mov instructions that
reference all operands to avoid unused-argument errors
in the check phase.
@yashhzd yashhzd force-pushed the test/asm-register-exhaustion branch from 51ebf0d to dc53180 Compare February 16, 2026 11:48
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
REPOSITORY                                   TAG       IMAGE ID       CREATED       SIZE
ghcr.io/dependabot/dependabot-updater-core   latest    afc745c7535d   2 weeks ago   783MB
=> Removing docker images...
Deleted Images:
untagged: ghcr.io/dependabot/dependabot-updater-core:latest
untagged: ghcr.io/dependabot/dependabot-updater-core@sha256:faae3d3a1dedd24cde388bb506bbacc0f7ed1eae99ebac129af66acd8540c84a
deleted: sha256:afc745c7535da1bb12f92c273b9a7e9c52c3f12c5873714b2542da259c6d9769
deleted: sha256:64e147d5e54d9be8b8aa322e511cda02296eda4b8b8d063c6a314833aca50e29
deleted: sha256:5cba409bb463f4e7fa1a19f695450170422582c1bc7c0e934d893b4e5f558bc6
deleted: sha256:cddc6ebd344b0111eaab170ead1dfda24acdfe865ed8a12599a34d338fa8e28b
deleted: sha256:2412c3f334d79134573cd45e657fb6cc0abd75bef3881458b0d498d936545c8d
---
test [ui] tests/ui/abi/abi-sysv64-register-usage.rs ... ignored, ignored when the architecture is aarch64
test [ui] tests/ui/abi/abi-typo-unstable.rs#feature_disabled ... ok
test [ui] tests/ui/abi/abi-typo-unstable.rs#feature_enabled ... ok
test [ui] tests/ui/abi/anon-extern-mod.rs ... ok
test [ui] tests/ui/abi/avr-sram.rs#disable_sram ... ok
test [ui] tests/ui/abi/arm-unadjusted-intrinsic.rs#aarch64 ... ok
test [ui] tests/ui/abi/avr-sram.rs#no_sram ... ok
test [ui] tests/ui/abi/avr-sram.rs#has_sram ... ok
test [ui] tests/ui/abi/arm-unadjusted-intrinsic.rs#arm ... ok
test [ui] tests/ui/abi/bad-custom.rs ... ok
test [ui] tests/ui/abi/c-stack-as-value.rs ... ok
test [ui] tests/ui/abi/c-zst.rs#aarch64-darwin ... ok
test [ui] tests/ui/abi/c-zst.rs#powerpc-linux ... ok
---
test [ui] tests/ui/asm/aarch64/ttbr0_el2.rs ... ok
test [ui] tests/ui/asm/aarch64/type-check-2.rs ... ok
test [ui] tests/ui/asm/aarch64/type-check-3.rs ... ok
test [ui] tests/ui/asm/aarch64/type-f16.rs ... ok
test [ui] tests/ui/asm/aarch64v8r.rs#r82 ... ok
test [ui] tests/ui/asm/aarch64v8r.rs#hf ... ok
test [ui] tests/ui/asm/aarch64v8r.rs#sf ... ok
test [ui] tests/ui/asm/aarch64/sym.rs ... ok
test [ui] tests/ui/asm/asm-with-nested-closure.rs ... ok
test [ui] tests/ui/asm/arm-low-dreg.rs ... ok
test [ui] tests/ui/asm/binary_asm_labels.rs ... ignored, only executed when the architecture is x86_64
test [ui] tests/ui/asm/arm-exhausted-registers.rs ... FAILED
---
test [ui] tests/ui/const-generics/occurs-check/unused-substs-2.rs ... ok
test [ui] tests/ui/const-generics/occurs-check/unused-substs-3.rs ... ok
test [ui] tests/ui/const-generics/occurs-check/unused-substs-5.rs ... ok
test [ui] tests/ui/const-generics/occurs-check/unused-substs-4.rs ... ok
test [ui] tests/ui/const-generics/ogca/basic.rs ... ok
test [ui] tests/ui/const-generics/ogca/basic-fail.rs ... ok
test [ui] tests/ui/const-generics/ogca/rhs-but-not-root.rs ... ok
test [ui] tests/ui/const-generics/ogca/coherence-ambiguous.rs ... ok
test [ui] tests/ui/const-generics/opaque_types.rs ... ok
test [ui] tests/ui/const-generics/opaque_types2.rs ... ok
test [ui] tests/ui/const-generics/outer-lifetime-in-const-generic-default.rs ... ok
test [ui] tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs#full ... ok
test [ui] tests/ui/const-generics/overlapping_impls.rs ... ok
---
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#fat2 ... ok
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#fat3 ... ok
test [ui] tests/ui/extern/issue-80074.rs ... ok
test [ui] tests/ui/extern/issue-95829.rs ... ok
test [ui] tests/ui/extern/lgamma-linkage.rs ... ok
test [ui] tests/ui/extern/no-mangle-associated-fn.rs ... ok
test [ui] tests/ui/extern/not-in-block.rs ... ok
test [ui] tests/ui/extern/unsized-extern-derefmove.rs ... ok
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#thin1 ... ok
test [ui] tests/ui/extern/windows-tcb-trash-13259.rs ... ok
---
test [ui] tests/ui/feature-gates/feature-gate-loop-match.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-macro-derive.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-macro-metavar-expr-concat.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-marker_trait_attr.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-mgca-type-const-syntax.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-may-dangle.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-min-generic-const-args.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-movrs_target_feature.rs ... ignored, only executed when the architecture is x86_64
test [ui] tests/ui/feature-gates/feature-gate-min_const_fn.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-more-maybe-bounds.rs ... ok
---
test [ui] tests/ui/imports/ambiguous-9.rs ... ok
test [ui] tests/ui/imports/ambiguous-import-visibility-module.rs ... ok
test [ui] tests/ui/imports/ambiguous-glob-vs-expanded-extern.rs ... ok
test [ui] tests/ui/imports/ambiguous-8.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-globvsglob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-glob-vs-multiouter.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-no-implicit-prelude.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-non-prelude-core-glob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-non-prelude-std-glob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-pick-core.rs ... ok
test [ui] tests/ui/imports/ambiguous-import-visibility-macro.rs ... ok
---
test [ui] tests/ui/layout/post-mono-layout-cycle.rs ... ok
test [ui] tests/ui/layout/randomize.rs#normal ... ok
test [ui] tests/ui/layout/randomize.rs#randomize-layout ... ok
test [ui] tests/ui/layout/null-pointer-optimization.rs ... ok
test [ui] tests/ui/layout/rigid-alias-due-to-broken-impl.rs ... ok
test [ui] tests/ui/layout/size-of-val-raw-too-big.rs ... ignored, only executed when the pointer width is 32bit (Layout computation rejects this layout for different reasons on 64-bit.)
test [ui] tests/ui/layout/reprc-power-alignment.rs ... ok
test [ui] tests/ui/layout/struct.rs ... ok
test [ui] tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.rs ... ok
test [ui] tests/ui/layout/thaw-validate-invalid-enum.rs ... ok
---

1 error: inline assembly requires more registers than available
2   --> $DIR/arm-exhausted-registers.rs:34:10
3    |
- LL |         "mov {0}, r0", //~ ERROR inline assembly requires more registers than available
+ LL |         "mov {0}, r0",
5    |          ^^^^^^^^^^^
6 
7 error: aborting due to 1 previous error

+ 
8 

Note: some mismatched output was normalized before being compared
- LL |         "mov {0}, r0", //~ ERROR inline assembly requires more registers than available
+ LL |         "mov {0}, r0",
+ 


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args asm/arm-exhausted-registers.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/asm/arm-exhausted-registers.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/asm/arm-exhausted-registers" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-Cpanic=abort" "-Cforce-unwind-tables=yes" "--target" "armv7-unknown-linux-gnueabihf" "--extern" "minicore=/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/asm/arm-exhausted-registers/libminicore.rlib"
stdout: none
--- stderr -------------------------------
error: inline assembly requires more registers than available
##[error]  --> /checkout/tests/ui/asm/arm-exhausted-registers.rs:34:10
   |
LL |         "mov {0}, r0", //~ ERROR inline assembly requires more registers than available
   |          ^^^^^^^^^^^

error: aborting due to 1 previous error
------------------------------------------

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

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

rustc SIGSEGV on asm macro when no more registers are availaible

7 participants