diff options
| author | bors <bors@rust-lang.org> | 2019-03-25 09:05:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-03-25 09:05:00 +0000 |
| commit | 3f36ac4e835dfa0af77d5261a444a674ec9da3a5 (patch) | |
| tree | 2a7f9b1a0749ac5f62e2b70c2840dd5d2bb1c82c /src | |
| parent | 60eca54a7ce931c590801048f54ac0b2d2cd5067 (diff) | |
| parent | 4728433c9ec07814b15868cb092afa2d60963cee (diff) | |
| download | rust-3f36ac4e835dfa0af77d5261a444a674ec9da3a5.tar.gz rust-3f36ac4e835dfa0af77d5261a444a674ec9da3a5.zip | |
Auto merge of #59242 - euclio:asm-ice, r=nagisa
make asm diagnostic instruction optional `DiagnosticInfoInlineAsm::getInstruction` may return a null pointer, so the instruction shouldn't be blindly unwrapped. Reopening from #55193. I was unable to trigger the assertion on Windows after rebasing. Fixes #23458. Fixes #55216.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_codegen_llvm/llvm/diagnostic.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-23458.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-23458.stderr | 17 |
3 files changed, 29 insertions, 2 deletions
diff --git a/src/librustc_codegen_llvm/llvm/diagnostic.rs b/src/librustc_codegen_llvm/llvm/diagnostic.rs index a8d272f157c..04e65ac4233 100644 --- a/src/librustc_codegen_llvm/llvm/diagnostic.rs +++ b/src/librustc_codegen_llvm/llvm/diagnostic.rs @@ -88,7 +88,7 @@ impl OptimizationDiagnostic<'ll> { pub struct InlineAsmDiagnostic<'ll> { pub cookie: c_uint, pub message: &'ll Twine, - pub instruction: &'ll Value, + pub instruction: Option<&'ll Value>, } impl InlineAsmDiagnostic<'ll> { @@ -107,7 +107,7 @@ impl InlineAsmDiagnostic<'ll> { InlineAsmDiagnostic { cookie, message: message.unwrap(), - instruction: instruction.unwrap(), + instruction, } } } diff --git a/src/test/ui/issues/issue-23458.rs b/src/test/ui/issues/issue-23458.rs new file mode 100644 index 00000000000..90b3f1f9714 --- /dev/null +++ b/src/test/ui/issues/issue-23458.rs @@ -0,0 +1,10 @@ +#![feature(asm)] + +// only-x86_64 + +fn main() { + unsafe { + asm!("int $3"); //~ ERROR too few operands for instruction + //~| ERROR invalid operand in inline asm + } +} diff --git a/src/test/ui/issues/issue-23458.stderr b/src/test/ui/issues/issue-23458.stderr new file mode 100644 index 00000000000..aff0f82af6f --- /dev/null +++ b/src/test/ui/issues/issue-23458.stderr @@ -0,0 +1,17 @@ +error: invalid operand in inline asm: 'int $3' + --> $DIR/issue-23458.rs:7:9 + | +LL | asm!("int $3"); + | ^^^^^^^^^^^^^^^ + +error: <inline asm>:1:2: error: too few operands for instruction + int + ^ + + --> $DIR/issue-23458.rs:7:9 + | +LL | asm!("int $3"); + | ^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + |
