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

Check if output is immediate value #69836

Merged
merged 1 commit into from
Mar 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/librustc_codegen_llvm/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
let mut indirect_outputs = vec![];
for (i, (out, &place)) in ia.outputs.iter().zip(&outputs).enumerate() {
if out.is_rw {
inputs.push(self.load_operand(place).immediate());
let operand = self.load_operand(place);
if let OperandValue::Immediate(_) = operand.val {
inputs.push(operand.immediate());
}
ext_constraints.push(i.to_string());
}
if out.is_indirect {
indirect_outputs.push(self.load_operand(place).immediate());
let operand = self.load_operand(place);
if let OperandValue::Immediate(_) = operand.val {
indirect_outputs.push(operand.immediate());
}
} else {
output_types.push(place.layout.llvm_type(self.cx()));
}
Expand Down
11 changes: 11 additions & 0 deletions src/test/ui/asm/issue-62046.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// build-fail
// ignore-emscripten no asm! support

#![feature(asm)]

fn main() {
unsafe {
asm!("nop" : "+r"("r15"));
//~^ malformed inline assembly
}
}
11 changes: 11 additions & 0 deletions src/test/ui/asm/issue-62046.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0668]: malformed inline assembly
--> $DIR/issue-62046.rs:8:9
|
LL | asm!("nop" : "+r"("r15"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0668`.