-
Notifications
You must be signed in to change notification settings - Fork 13.3k
ice: asm: unreachable #112635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
C-bug
Category: This is a bug.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
Regressed in 1.58: Godbolt |
Dylan-DPC
added a commit
to Dylan-DPC/rust
that referenced
this issue
Jun 16, 2023
…ompiler-errors fix ICE on specific malformed asm clobber_abi fixes rust-lang#112635
Zalathar
added a commit
to Zalathar/rust
that referenced
this issue
May 19, 2025
…s, r=Amanieu in `tests/ui/asm/aarch64/parse-error.rs`, only test cases specific to that target this is more in line with the x86 parse error tests at https://github.com/rust-lang/rust/blob/master/tests/ui/asm/x86_64/x86_64_parse_error.rs. We could at this point use minicore so that these tests run no matter the host target? `tests/ui/asm/aarch64/parse-error.rs` was mostly a copy of https://github.com/rust-lang/rust/blob/master/tests/ui/asm/parse-error.rs, though a bit out of date. The only aarch64-specific tests are those that talk about register names. Here is a diff between those two files: ```diff --- <unnamed> +++ <unnamed> `@@` -1,4 +1,4 `@@` -//@ needs-asm-support +//@ only-aarch64 use std::arch::{asm, global_asm}; `@@` -36,36 +36,12 `@@` //~^ ERROR expected one of asm!("{}", options(), const foo); //~^ ERROR attempt to use a non-constant value in a constant - - // test that asm!'s clobber_abi doesn't accept non-string literals - // see also rust-lang#112635 - asm!("", clobber_abi()); - //~^ ERROR at least one abi must be provided asm!("", clobber_abi(foo)); //~^ ERROR expected string literal asm!("", clobber_abi("C" foo)); //~^ ERROR expected one of `)` or `,`, found `foo` asm!("", clobber_abi("C", foo)); //~^ ERROR expected string literal - asm!("", clobber_abi(1)); - //~^ ERROR expected string literal - asm!("", clobber_abi(())); - //~^ ERROR expected string literal - asm!("", clobber_abi(uwu)); - //~^ ERROR expected string literal - asm!("", clobber_abi({})); - //~^ ERROR expected string literal - asm!("", clobber_abi(loop {})); - //~^ ERROR expected string literal - asm!("", clobber_abi(if)); - //~^ ERROR expected string literal - asm!("", clobber_abi(do)); - //~^ ERROR expected string literal - asm!("", clobber_abi(<)); - //~^ ERROR expected string literal - asm!("", clobber_abi(.)); - //~^ ERROR expected string literal - asm!("{}", clobber_abi("C"), const foo); //~^ ERROR attempt to use a non-constant value in a constant asm!("", options(), clobber_abi("C")); `@@` -76,7 +52,15 `@@` //~^^ ERROR argument never used //~^^^ ERROR attempt to use a non-constant value in a constant //~^^^^ ERROR attempt to use a non-constant value in a constant - + asm!("", a = in("x0") foo); + //~^ ERROR explicit register arguments cannot have names + asm!("{a}", in("x0") foo, a = const bar); + //~^ ERROR attempt to use a non-constant value in a constant + asm!("{a}", in("x0") foo, a = const bar); + //~^ ERROR attempt to use a non-constant value in a constant + asm!("{1}", in("x0") foo, const bar); + //~^ ERROR positional arguments cannot follow named arguments or explicit register arguments + //~^^ ERROR attempt to use a non-constant value in a constant asm!("", options(), ""); //~^ ERROR expected one of asm!("{}", in(reg) foo, "{}", out(reg) foo); `@@` -109,13 +93,11 `@@` global_asm!("{}", const(reg) FOO); //~^ ERROR expected one of global_asm!("", options(FOO)); -//~^ ERROR expected one of `)`, `att_syntax`, or `raw`, found `FOO` -global_asm!("", options(FOO,)); -//~^ ERROR expected one of `)`, `att_syntax`, or `raw`, found `FOO` +//~^ ERROR expected one of global_asm!("", options(nomem FOO)); -//~^ ERROR expected one of `)` or `,`, found `FOO` +//~^ ERROR expected one of global_asm!("", options(nomem, FOO)); -//~^ ERROR expected one of `)`, `att_syntax`, or `raw`, found `FOO` +//~^ ERROR expected one of global_asm!("{}", options(), const FOO); global_asm!("", clobber_abi(FOO)); //~^ ERROR expected string literal `@@` -129,8 +111,6 `@@` //~^ ERROR `clobber_abi` cannot be used with `global_asm!` global_asm!("{}", options(), clobber_abi("C"), const FOO); //~^ ERROR `clobber_abi` cannot be used with `global_asm!` -global_asm!("", clobber_abi("C"), clobber_abi("C")); -//~^ ERROR `clobber_abi` cannot be used with `global_asm!` global_asm!("{a}", a = const FOO, a = const BAR); //~^ ERROR duplicate argument named `a` //~^^ ERROR argument never used `@@` -142,16 +122,3 `@@` //~^ ERROR asm template must be a string literal global_asm!("{1}", format!("{{{}}}", 0), const FOO, const BAR); //~^ ERROR asm template must be a string literal - -global_asm!("{}", in(reg)); -//~^ ERROR the `in` operand cannot be used with `global_asm!` -global_asm!("{}", out(reg)); -//~^ ERROR the `out` operand cannot be used with `global_asm!` -global_asm!("{}", lateout(reg)); -//~^ ERROR the `lateout` operand cannot be used with `global_asm!` -global_asm!("{}", inout(reg)); -//~^ ERROR the `inout` operand cannot be used with `global_asm!` -global_asm!("{}", inlateout(reg)); -//~^ ERROR the `inlateout` operand cannot be used with `global_asm!` -global_asm!("{}", label(reg)); -//~^ ERROR the `label` operand cannot be used with `global_asm!` ```
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
May 19, 2025
Rollup merge of rust-lang#141242 - folkertdev:aarch64-asm-parse-errors, r=Amanieu in `tests/ui/asm/aarch64/parse-error.rs`, only test cases specific to that target this is more in line with the x86 parse error tests at https://github.com/rust-lang/rust/blob/master/tests/ui/asm/x86_64/x86_64_parse_error.rs. We could at this point use minicore so that these tests run no matter the host target? `tests/ui/asm/aarch64/parse-error.rs` was mostly a copy of https://github.com/rust-lang/rust/blob/master/tests/ui/asm/parse-error.rs, though a bit out of date. The only aarch64-specific tests are those that talk about register names. Here is a diff between those two files: ```diff --- <unnamed> +++ <unnamed> `@@` -1,4 +1,4 `@@` -//@ needs-asm-support +//@ only-aarch64 use std::arch::{asm, global_asm}; `@@` -36,36 +36,12 `@@` //~^ ERROR expected one of asm!("{}", options(), const foo); //~^ ERROR attempt to use a non-constant value in a constant - - // test that asm!'s clobber_abi doesn't accept non-string literals - // see also rust-lang#112635 - asm!("", clobber_abi()); - //~^ ERROR at least one abi must be provided asm!("", clobber_abi(foo)); //~^ ERROR expected string literal asm!("", clobber_abi("C" foo)); //~^ ERROR expected one of `)` or `,`, found `foo` asm!("", clobber_abi("C", foo)); //~^ ERROR expected string literal - asm!("", clobber_abi(1)); - //~^ ERROR expected string literal - asm!("", clobber_abi(())); - //~^ ERROR expected string literal - asm!("", clobber_abi(uwu)); - //~^ ERROR expected string literal - asm!("", clobber_abi({})); - //~^ ERROR expected string literal - asm!("", clobber_abi(loop {})); - //~^ ERROR expected string literal - asm!("", clobber_abi(if)); - //~^ ERROR expected string literal - asm!("", clobber_abi(do)); - //~^ ERROR expected string literal - asm!("", clobber_abi(<)); - //~^ ERROR expected string literal - asm!("", clobber_abi(.)); - //~^ ERROR expected string literal - asm!("{}", clobber_abi("C"), const foo); //~^ ERROR attempt to use a non-constant value in a constant asm!("", options(), clobber_abi("C")); `@@` -76,7 +52,15 `@@` //~^^ ERROR argument never used //~^^^ ERROR attempt to use a non-constant value in a constant //~^^^^ ERROR attempt to use a non-constant value in a constant - + asm!("", a = in("x0") foo); + //~^ ERROR explicit register arguments cannot have names + asm!("{a}", in("x0") foo, a = const bar); + //~^ ERROR attempt to use a non-constant value in a constant + asm!("{a}", in("x0") foo, a = const bar); + //~^ ERROR attempt to use a non-constant value in a constant + asm!("{1}", in("x0") foo, const bar); + //~^ ERROR positional arguments cannot follow named arguments or explicit register arguments + //~^^ ERROR attempt to use a non-constant value in a constant asm!("", options(), ""); //~^ ERROR expected one of asm!("{}", in(reg) foo, "{}", out(reg) foo); `@@` -109,13 +93,11 `@@` global_asm!("{}", const(reg) FOO); //~^ ERROR expected one of global_asm!("", options(FOO)); -//~^ ERROR expected one of `)`, `att_syntax`, or `raw`, found `FOO` -global_asm!("", options(FOO,)); -//~^ ERROR expected one of `)`, `att_syntax`, or `raw`, found `FOO` +//~^ ERROR expected one of global_asm!("", options(nomem FOO)); -//~^ ERROR expected one of `)` or `,`, found `FOO` +//~^ ERROR expected one of global_asm!("", options(nomem, FOO)); -//~^ ERROR expected one of `)`, `att_syntax`, or `raw`, found `FOO` +//~^ ERROR expected one of global_asm!("{}", options(), const FOO); global_asm!("", clobber_abi(FOO)); //~^ ERROR expected string literal `@@` -129,8 +111,6 `@@` //~^ ERROR `clobber_abi` cannot be used with `global_asm!` global_asm!("{}", options(), clobber_abi("C"), const FOO); //~^ ERROR `clobber_abi` cannot be used with `global_asm!` -global_asm!("", clobber_abi("C"), clobber_abi("C")); -//~^ ERROR `clobber_abi` cannot be used with `global_asm!` global_asm!("{a}", a = const FOO, a = const BAR); //~^ ERROR duplicate argument named `a` //~^^ ERROR argument never used `@@` -142,16 +122,3 `@@` //~^ ERROR asm template must be a string literal global_asm!("{1}", format!("{{{}}}", 0), const FOO, const BAR); //~^ ERROR asm template must be a string literal - -global_asm!("{}", in(reg)); -//~^ ERROR the `in` operand cannot be used with `global_asm!` -global_asm!("{}", out(reg)); -//~^ ERROR the `out` operand cannot be used with `global_asm!` -global_asm!("{}", lateout(reg)); -//~^ ERROR the `lateout` operand cannot be used with `global_asm!` -global_asm!("{}", inout(reg)); -//~^ ERROR the `inout` operand cannot be used with `global_asm!` -global_asm!("{}", inlateout(reg)); -//~^ ERROR the `inlateout` operand cannot be used with `global_asm!` -global_asm!("{}", label(reg)); -//~^ ERROR the `label` operand cannot be used with `global_asm!` ```
RalfJung
pushed a commit
to RalfJung/miri
that referenced
this issue
May 20, 2025
in `tests/ui/asm/aarch64/parse-error.rs`, only test cases specific to that target this is more in line with the x86 parse error tests at https://github.com/rust-lang/rust/blob/master/tests/ui/asm/x86_64/x86_64_parse_error.rs. We could at this point use minicore so that these tests run no matter the host target? `tests/ui/asm/aarch64/parse-error.rs` was mostly a copy of https://github.com/rust-lang/rust/blob/master/tests/ui/asm/parse-error.rs, though a bit out of date. The only aarch64-specific tests are those that talk about register names. Here is a diff between those two files: ```diff --- <unnamed> +++ <unnamed> `@@` -1,4 +1,4 `@@` -//@ needs-asm-support +//@ only-aarch64 use std::arch::{asm, global_asm}; `@@` -36,36 +36,12 `@@` //~^ ERROR expected one of asm!("{}", options(), const foo); //~^ ERROR attempt to use a non-constant value in a constant - - // test that asm!'s clobber_abi doesn't accept non-string literals - // see also rust-lang/rust#112635 - asm!("", clobber_abi()); - //~^ ERROR at least one abi must be provided asm!("", clobber_abi(foo)); //~^ ERROR expected string literal asm!("", clobber_abi("C" foo)); //~^ ERROR expected one of `)` or `,`, found `foo` asm!("", clobber_abi("C", foo)); //~^ ERROR expected string literal - asm!("", clobber_abi(1)); - //~^ ERROR expected string literal - asm!("", clobber_abi(())); - //~^ ERROR expected string literal - asm!("", clobber_abi(uwu)); - //~^ ERROR expected string literal - asm!("", clobber_abi({})); - //~^ ERROR expected string literal - asm!("", clobber_abi(loop {})); - //~^ ERROR expected string literal - asm!("", clobber_abi(if)); - //~^ ERROR expected string literal - asm!("", clobber_abi(do)); - //~^ ERROR expected string literal - asm!("", clobber_abi(<)); - //~^ ERROR expected string literal - asm!("", clobber_abi(.)); - //~^ ERROR expected string literal - asm!("{}", clobber_abi("C"), const foo); //~^ ERROR attempt to use a non-constant value in a constant asm!("", options(), clobber_abi("C")); `@@` -76,7 +52,15 `@@` //~^^ ERROR argument never used //~^^^ ERROR attempt to use a non-constant value in a constant //~^^^^ ERROR attempt to use a non-constant value in a constant - + asm!("", a = in("x0") foo); + //~^ ERROR explicit register arguments cannot have names + asm!("{a}", in("x0") foo, a = const bar); + //~^ ERROR attempt to use a non-constant value in a constant + asm!("{a}", in("x0") foo, a = const bar); + //~^ ERROR attempt to use a non-constant value in a constant + asm!("{1}", in("x0") foo, const bar); + //~^ ERROR positional arguments cannot follow named arguments or explicit register arguments + //~^^ ERROR attempt to use a non-constant value in a constant asm!("", options(), ""); //~^ ERROR expected one of asm!("{}", in(reg) foo, "{}", out(reg) foo); `@@` -109,13 +93,11 `@@` global_asm!("{}", const(reg) FOO); //~^ ERROR expected one of global_asm!("", options(FOO)); -//~^ ERROR expected one of `)`, `att_syntax`, or `raw`, found `FOO` -global_asm!("", options(FOO,)); -//~^ ERROR expected one of `)`, `att_syntax`, or `raw`, found `FOO` +//~^ ERROR expected one of global_asm!("", options(nomem FOO)); -//~^ ERROR expected one of `)` or `,`, found `FOO` +//~^ ERROR expected one of global_asm!("", options(nomem, FOO)); -//~^ ERROR expected one of `)`, `att_syntax`, or `raw`, found `FOO` +//~^ ERROR expected one of global_asm!("{}", options(), const FOO); global_asm!("", clobber_abi(FOO)); //~^ ERROR expected string literal `@@` -129,8 +111,6 `@@` //~^ ERROR `clobber_abi` cannot be used with `global_asm!` global_asm!("{}", options(), clobber_abi("C"), const FOO); //~^ ERROR `clobber_abi` cannot be used with `global_asm!` -global_asm!("", clobber_abi("C"), clobber_abi("C")); -//~^ ERROR `clobber_abi` cannot be used with `global_asm!` global_asm!("{a}", a = const FOO, a = const BAR); //~^ ERROR duplicate argument named `a` //~^^ ERROR argument never used `@@` -142,16 +122,3 `@@` //~^ ERROR asm template must be a string literal global_asm!("{1}", format!("{{{}}}", 0), const FOO, const BAR); //~^ ERROR asm template must be a string literal - -global_asm!("{}", in(reg)); -//~^ ERROR the `in` operand cannot be used with `global_asm!` -global_asm!("{}", out(reg)); -//~^ ERROR the `out` operand cannot be used with `global_asm!` -global_asm!("{}", lateout(reg)); -//~^ ERROR the `lateout` operand cannot be used with `global_asm!` -global_asm!("{}", inout(reg)); -//~^ ERROR the `inout` operand cannot be used with `global_asm!` -global_asm!("{}", inlateout(reg)); -//~^ ERROR the `inlateout` operand cannot be used with `global_asm!` -global_asm!("{}", label(reg)); -//~^ ERROR the `label` operand cannot be used with `global_asm!` ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: This is a bug.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: