You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use std::arch::{asm, global_asm};global_asm!(".macro test.endm");fnfunction<constN:u32>(){unsafe{asm!("test",options(noreturn))}}fnmain(){function::<1>()}
I expected to see this happen: This code should work when compiling for release and debug.
Instead, this happened: It builds fine using --release. In debug mode, the inline assembler can't see the macro test.
I'd expect that either both Debug and Release work or that both fail equally.
~/CLionProjects/untitled1 % cargo run
Compiling untitled1 v0.1.0 (/Users/daniel/CLionProjects/untitled1)
error: unrecognized instruction mnemonic, did you mean: tst?
--> src/main.rs:11:15
|
11 | asm!("test", options(noreturn))
| ^
|
note: instantiated into assembly here
--> <inline asm>:1:2
|
1 | test
| ^
error: could not compile `untitled1` due to previous error
~/CLionProjects/untitled1 % cargo run --release
Compiling untitled1 v0.1.0 (/Users/daniel/CLionProjects/untitled1)
Finished release [optimized] target(s) in 0.10s
Running `target/release/untitled1`
This is explicitly not supported by inline assembly:
If inline assembly includes any "stateful" directive that modifies how subsequent assembly is processed, the block must undo the effects of any such directives before the inline assembly ends.
Basically you can't rely on things defined in other asm blocks.
I tried this code:
I expected to see this happen: This code should work when compiling for release and debug.
Instead, this happened: It builds fine using --release. In debug mode, the inline assembler can't see the macro test.
I'd expect that either both Debug and Release work or that both fail equally.
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: