Skip to content
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

compile-fail/asm-src-loc.rs fails on ARM when compiled without optimizations #40555

Closed
TimNN opened this issue Mar 15, 2017 · 3 comments · Fixed by #73322
Closed

compile-fail/asm-src-loc.rs fails on ARM when compiled without optimizations #40555

TimNN opened this issue Mar 15, 2017 · 3 comments · Fixed by #73322
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-inline-assembly Area: Inline assembly (`asm!(…)`) C-bug Category: This is a bug. O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@TimNN
Copy link
Contributor

TimNN commented Mar 15, 2017

(Cross) compiling this test for arm-unknown-linux-gnueabihf fails because the error span is missing. (Reproduced on nightly-2017-03-04)

#![feature(asm)]

fn main() {
    unsafe {
        asm!("nowayisthisavalidinstruction"); //~ ERROR instruction
    }
}

Output of rustc --target=arm-unknown-linux-gnueabihf -Copt-level=0:

error: <inline asm>:1:2: error: invalid instruction
        nowayisthisavalidinstruction
        ^


error: aborting due to previous error

Output of rustc --target=arm-unknown-linux-gnueabihf -Copt-level=1:

error: <inline asm>:1:2: error: invalid instruction
        nowayisthisavalidinstruction
        ^

 --> asmt.rs:5:9
  |
5 |         asm!("nowayisthisavalidinstruction"); //~ ERROR instruction
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error
@TimNN TimNN added O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state A-diagnostics Area: Messages for errors, warnings, and lints A-inline-assembly Area: Inline assembly (`asm!(…)`) labels Mar 15, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 26, 2017
@Centril Centril added the requires-nightly This issue requires a nightly compiler in some way. label Oct 25, 2019
@Amanieu
Copy link
Member

Amanieu commented May 24, 2020

This seems to be an LLVM bug, I can reproduce the same behavior in Clang.

$ cat clang_asm.c 
int main() {
    asm("nowayisthisavalidinstruction");
    return 0;
}
$ clang -target arm-unknown-linux-gnueabihf clang_asm.c
<inline asm>:1:2: error: invalid instruction
        nowayisthisavalidinstruction
        ^
1 error generated.
$ clang -target arm-unknown-linux-gnueabihf clang_asm.c -O1
clang_asm.c:2:9: error: invalid instruction
    asm("nowayisthisavalidinstruction");
        ^
<inline asm>:1:2: note: instantiated into assembly here
        nowayisthisavalidinstruction
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

@Amanieu
Copy link
Member

Amanieu commented May 24, 2020

@Amanieu
Copy link
Member

Amanieu commented May 31, 2020

Will be fixed by https://reviews.llvm.org/D80759

@crlf0710 crlf0710 added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 11, 2020
@bors bors closed this as completed in e8ff4bc Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-inline-assembly Area: Inline assembly (`asm!(…)`) C-bug Category: This is a bug. O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants