diff --git a/libgccjit.version b/libgccjit.version index 104e5c7e2a0..e247ce7d3bb 100644 --- a/libgccjit.version +++ b/libgccjit.version @@ -1 +1 @@ -d98bd412c7fb6bf8f2258e75f2e2b42f56a06bc1 +2f06e64df0dc15f861f77595b77bfc2ba5deb59d diff --git a/src/asm.rs b/src/asm.rs index f4b2934178a..a61963f7f79 100644 --- a/src/asm.rs +++ b/src/asm.rs @@ -592,6 +592,12 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> { self.llbb().add_eval(None, self.context.new_call(None, builtin_unreachable, &[])); } + if !options.contains(InlineAsmOptions::NORETURN) + && let Some(dest) = dest + { + self.switch_to_block(dest); + } + // Write results to outputs. // // We need to do this because: diff --git a/tests/run/asm.rs b/tests/run/asm.rs index 2d78f5ad5f9..adbf8465b17 100644 --- a/tests/run/asm.rs +++ b/tests/run/asm.rs @@ -3,6 +3,8 @@ // Run-time: // status: 0 +#![feature(asm_goto_with_outputs)] + #[cfg(target_arch = "x86_64")] use std::arch::{asm, global_asm}; @@ -32,6 +34,20 @@ pub unsafe fn mem_cpy(dst: *mut u8, src: *const u8, len: usize) { ); } +#[cfg(target_arch = "x86_64")] +#[unsafe(no_mangle)] +pub fn asm_goto_test(mut a: i16) -> i16 { + unsafe { + std::arch::asm!( + "jmp {op}", + inout("eax") a, + op = label { a = 7; }, + options(nostack,nomem) + ); + a + } +} + #[cfg(target_arch = "x86_64")] fn asm() { unsafe { @@ -235,6 +251,8 @@ fn asm() { out("r15b") _, ); } + + asm_goto_test(0); } #[cfg(not(target_arch = "x86_64"))]