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

LLVM assertion with asm! output constraint for "d" on x86 and x86_64 #28587

Closed
emberian opened this issue Sep 22, 2015 · 7 comments
Closed

LLVM assertion with asm! output constraint for "d" on x86 and x86_64 #28587

emberian opened this issue Sep 22, 2015 · 7 comments
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`) C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way.

Comments

@emberian
Copy link
Member

#![feature(asm)]

fn main() {
    let a: usize;

    unsafe {
        asm!("" : "=d"(a) : : : );
    }
}
vagrant@vagrant-ubuntu-trusty-64:~$ rustc reg-repro.rs 
reg-repro.rs:4:9: 4:10 warning: variable `a` is assigned to, but never used, #[warn(unused_variables)] on by default
reg-repro.rs:4     let a: usize;
                       ^
reg-repro.rs:7:24: 7:25 warning: value assigned to `a` is never read, #[warn(unused_assignments)] on by default
reg-repro.rs:7         asm!("" : "=d"(a) : : : );
                                      ^
note: in expansion of asm!
reg-repro.rs:7:9: 7:35 note: expansion site
rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h:169: unsigned int llvm::FunctionLoweringInfo::InitializeRegForValue(const llvm::Value*): Assertion `R == 0 && "Already initialized this value register!"' failed.
@emberian emberian added the A-inline-assembly Area: Inline assembly (`asm!(…)`) label Sep 22, 2015
@emberian emberian changed the title LLVM assertion with output constraint for "d" on x86 and x86_64 LLVM assertion with asm! output constraint for "d" on x86 and x86_64 Sep 22, 2015
@nagisa
Copy link
Member

nagisa commented Sep 26, 2015

Relevant discussion

@jooert
Copy link
Contributor

jooert commented Mar 16, 2017

Triage: This doesn't assert anymore but gives a proper error while compiling (see https://is.gd/zIn5HT).

@Mark-Simulacrum
Copy link
Member

Reproduced today, and as above, no LLVM assertion. E-needstest.

@Mark-Simulacrum Mark-Simulacrum added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jun 13, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 24, 2017
varkor added a commit to varkor/rust that referenced this issue Feb 26, 2019
Centril added a commit to Centril/rust that referenced this issue Feb 27, 2019
…hton

Add tests for several E-needstest issues

This PR adds a number of tests for various `E-needstest` errors. These tend to have been left open for a long time and seem unlikely to be closed otherwise.

Closes rust-lang#10876.
Closes rust-lang#22892.
Closes rust-lang#26448.
Closes rust-lang#26577.
Closes rust-lang#26619.
Closes rust-lang#27054.
Closes rust-lang#28587.
Closes rust-lang#44127.
Closes rust-lang#44255.
Closes rust-lang#55731.
Closes rust-lang#57781.
varkor added a commit to varkor/rust that referenced this issue Feb 27, 2019
pietroalbini added a commit to pietroalbini/rust that referenced this issue Mar 1, 2019
…hton

Add tests for several E-needstest issues

This PR adds a number of tests for various `E-needstest` errors. These tend to have been left open for a long time and seem unlikely to be closed otherwise.

Closes rust-lang#10876.
Closes rust-lang#22892.
Closes rust-lang#26448.
Closes rust-lang#26577.
Closes rust-lang#26619.
Closes rust-lang#27054.
Closes rust-lang#28587.
Closes rust-lang#44127.
Closes rust-lang#44255.
Closes rust-lang#55731.
Closes rust-lang#57781.
Centril added a commit to Centril/rust that referenced this issue Mar 9, 2019
…hton

Add tests for several E-needstest issues

This PR adds a number of tests for various `E-needstest` errors. These tend to have been left open for a long time and seem unlikely to be closed otherwise.

Closes rust-lang#10876.
Closes rust-lang#22892.
Closes rust-lang#26448.
Closes rust-lang#26577.
Closes rust-lang#26619.
Closes rust-lang#27054.
Closes rust-lang#28587.
Closes rust-lang#44127.
Closes rust-lang#44255.
Closes rust-lang#55731.
Closes rust-lang#57781.
Centril added a commit to Centril/rust that referenced this issue Mar 9, 2019
…hton

Add tests for several E-needstest issues

This PR adds a number of tests for various `E-needstest` errors. These tend to have been left open for a long time and seem unlikely to be closed otherwise.

Closes rust-lang#10876.
Closes rust-lang#22892.
Closes rust-lang#26448.
Closes rust-lang#26577.
Closes rust-lang#26619.
Closes rust-lang#27054.
Closes rust-lang#28587.
Closes rust-lang#44127.
Closes rust-lang#44255.
Closes rust-lang#55731.
Closes rust-lang#57781.
@varkor
Copy link
Member

varkor commented Mar 9, 2019

There seem to still be issues with this test case on armhf-gnu: #59046 (comment).

@Mark-Simulacrum
Copy link
Member

Seems we aren't quite ready for a test case here.

@rustbot modify labels: -E-needstest.

@rustbot rustbot removed the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Mar 9, 2019
varkor added a commit to varkor/rust that referenced this issue Mar 11, 2019
varkor added a commit to varkor/rust that referenced this issue Mar 12, 2019
@lenary
Copy link
Contributor

lenary commented Aug 23, 2019

The constraint codes in LLVM inline assembly are very target dependent. Any tests using these should be gated by target, which should avoid flakiness, and most flakiness in the constraints will be caused by LLVM and not rustc.

@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 22, 2020

This issue does not apply to the new asm! (RFC 2850) which validates operand register classes.

The legacy llvm_asm! is deprecated and is no longer maintained.

@Amanieu Amanieu closed this as completed May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`) C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way.
Projects
None yet
Development

No branches or pull requests

9 participants