Skip to content

Inline assembly disappears from output #26648

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
uzytkownik opened this issue Jun 29, 2015 · 4 comments
Closed

Inline assembly disappears from output #26648

uzytkownik opened this issue Jun 29, 2015 · 4 comments
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`)

Comments

@uzytkownik
Copy link

It seems like bug in LLVM generator. Code

let rip: u64;
asm!("movq %rip, %rax" : "={rax}"(rip) ::: "volatile");

Produces correct LLVM IR:

  %46 = call i64 asm sideeffect "movq %rip, %rax", "={rax},~{dirflag},~{fpsr},~{flags}"(), !dbg !4561, !srcloc !4562

But the output sometimes does not contain the instruction and the value of rip is 0x1d1d1d1d1d1d1d1d.

@huonw huonw added the A-inline-assembly Area: Inline assembly (`asm!(…)`) label Jun 29, 2015
@eefriedman
Copy link
Contributor

Umm, I think you meant to write "leaq (%rip), %rax"? You can't MOV out of RIP.

It's probably a bug that LLVM doesn't reject it, though.

@uzytkownik
Copy link
Author

It looks like this is issue 22892 after all.

Umm, I think you meant to write "leaq (%rip), %rax"? You can't MOV out of RIP.

Yes, I just didn't remembered that I cannot.

@jethrogb
Copy link
Contributor

Referencing #22892

@jethrogb
Copy link
Contributor

jethrogb commented Apr 28, 2017

This issue can be closed, fixed in nightly: https://is.gd/Q3RvxB

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`)
Projects
None yet
Development

No branches or pull requests

5 participants