Skip to content

compiler segfault with deref of *() in asm arg #13520

Closed
@kmcallister

Description

@kmcallister
#![feature(asm)]

fn main() {
    let x = ();
    unsafe {
        let p: *const () = &x;
        asm!("" :: "r"(*p));
    }
}
$ rustc -v
rustc 0.11-pre (cee9a83 2014-04-11 15:54:46 -0700)
host: x86_64-unknown-linux-gnu

$ gdb --args rustc foo.rs
(gdb) run
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6119b99 in llvm::X86TargetLowering::isZExtFree(llvm::SDValue, llvm::EVT) const ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
(gdb) bt
#0  0x00007ffff6119b99 in llvm::X86TargetLowering::isZExtFree(llvm::SDValue, llvm::EVT) const ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#1  0x00007ffff62650fd in (anonymous namespace)::RegsForValue::getCopyToRegs(llvm::SDValue, llvm::SelectionDAG&, llvm::SDLoc, llvm::SDValue&, llvm::SDValue*, llvm::Value const*) const () from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#2  0x00007ffff627d822 in llvm::SelectionDAGBuilder::visitInlineAsm(llvm::ImmutableCallSite) ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#3  0x00007ffff628d5a3 in llvm::SelectionDAGBuilder::visitCall(llvm::CallInst const&) ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#4  0x00007ffff629bc1a in llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#5  0x00007ffff62ad491 in llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::Instruction const>, llvm::ilist_iterator<llvm::Instruction const>, bool&) () from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#6  0x00007ffff62aeee8 in llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#7  0x00007ffff62b0de5 in llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#8  0x00007ffff6a3d56f in llvm::FPPassManager::runOnFunction(llvm::Function&) ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#9  0x00007ffff6a3d5bb in llvm::FPPassManager::runOnModule(llvm::Module&) ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#10 0x00007ffff6a3d12f in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#11 0x00007ffff5d4fa5c in LLVMRustWriteOutputFile (Target=0x660720, PMR=0x69a400, M=0x6b7ca0, path=<optimized out>, 
    FileType=llvm::TargetMachine::CGFT_ObjectFile) at /home/keegan/proj/rust/rust/src/rustllvm/PassWrapper.cpp:181
#12 0x00007ffff5bfda5c in back::link::WriteOutputFile::hbd128889f580a8157n0::v0.11.pre ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#13 0x00007ffff5c0396e in back::link::write::run_passes::closure.83721 ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#14 0x00007ffff58d44d5 in util::common::time::h1b088cb92ee0b019kMg::v0.11.pre ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#15 0x00007ffff5bff8a0 in back::link::write::run_passes::hae8f9777a11894c2mq0::v0.11.pre ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#16 0x00007ffff5d10490 in driver::driver::phase_5_run_llvm_passes::closure.90168 ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#17 0x00007ffff58d44d5 in util::common::time::h1b088cb92ee0b019kMg::v0.11.pre ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#18 0x00007ffff5d1031b in driver::driver::phase_5_run_llvm_passes::h10b364552bbe780eQIe::v0.11.pre ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#19 0x00007ffff5d130f2 in driver::driver::compile_input::hef357caacd97acfcPXe::v0.11.pre ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#20 0x00007ffff5d375f5 in run_compiler::ha4e573becdf712cbfvm::v0.11.pre ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#21 0x00007ffff5d4c07c in main_args::closure.92079 ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#22 0x00007ffff5d4aa26 in monitor::closure.91964 () from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#23 0x00007ffff5d462d8 in task::TaskBuilder::try::closure.91739 ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/librustc-4283bb68-0.11-pre.so
#24 0x00007ffff7bbb348 in task::spawn_opts::closure.7852 ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libnative-83574243-0.11-pre.so
#25 0x00007ffff4b76b03 in rt::task::Task::run::closure.39978 ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-aad93cea-0.11-pre.so
#26 0x00007ffff4b8213c in rust_try () from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-aad93cea-0.11-pre.so
#27 0x00007ffff4b76962 in rt::task::Task::run::h6d25268f43c2f945vc8::v0.11.pre ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-aad93cea-0.11-pre.so
#28 0x00007ffff7bbb1d0 in task::spawn_opts::closure.7825 ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libnative-83574243-0.11-pre.so
#29 0x00007ffff4b7a24f in rt::thread::thread_start::hceb81ee57b19689fdR8::v0.11.pre ()
   from /home/keegan/proj/rust/rust/x86_64-unknown-linux-gnu/stage2/bin/../lib/libstd-aad93cea-0.11-pre.so
#30 0x00007ffff1f29b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#31 0x00007ffff47c30ed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#32 0x0000000000000000 in ?? ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-inline-assemblyArea: Inline assembly (`asm!(…)`)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.P-mediumMedium priorityglacierICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions