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

sepcomp-lib-lto test fails on master with --enable-debug #26447

Closed
ghost opened this issue Jun 20, 2015 · 2 comments · Fixed by #27689
Closed

sepcomp-lib-lto test fails on master with --enable-debug #26447

ghost opened this issue Jun 20, 2015 · 2 comments · Fixed by #27689
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-testsuite Area: The testsuite used to check the correctness of rustc

Comments

@ghost
Copy link

ghost commented Jun 20, 2015

When compiling with --enable-debug, the sepcomp-lib-lto test fails. It passes if I build without --enable-debug. Relevant build output:

$ git rev-parse HEAD
a9515698fa456390386087ccb6123ce741f18527
$ uname -a
Linux dev 3.19.0-18-generic #18-Ubuntu SMP Tue May 19 18:31:35 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
$ ./configure --enable-debug
$ make -j12 check-stage1-rpass TESTNAME=sepcomp-lib-lto

...

running 1 test
test [run-pass] run-pass/sepcomp-lib-lto.rs ... FAILED

failures:

---- [run-pass] run-pass/sepcomp-lib-lto.rs stdout ----

error: compilation failed!
status: signal: 6
command: x86_64-unknown-linux-gnu/stage1/bin/rustc /home/ubuntu/rust/src/test/run-pass/sepcomp-lib-lto.rs -L x86_64-unknown-linux-gnu/test/run-pass/ --target=x86_64-unknown-linux-gnu -L x86_64-unknown-linux-gnu/test/run-pass/sepcomp-lib-lto.stage1-x86_64-unknown-linux-gnu.run-pass.libaux -o x86_64-unknown-linux-gnu/test/run-pass/sepcomp-lib-lto.stage1-x86_64-unknown-linux-gnu -O -L x86_64-unknown-linux-gnu/rt -C lto
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
rustc: /home/ubuntu/rust/src/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp:708: llvm::DIE* llvm::DwarfUnit::getOrCreateTypeDIE(const llvm::MDNode*): Assertion `Ty == resolve(Ty->getRef()) && "type was not uniqued, possible ODR violation."' failed.

------------------------------------------

thread '[run-pass] run-pass/sepcomp-lib-lto.rs' panicked at 'explicit panic', /home/ubuntu/rust/src/compiletest/runtest.rs:1497



failures:
    [run-pass] run-pass/sepcomp-lib-lto.rs

    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured

    thread '<main>' panicked at 'Some tests failed', /home/ubuntu/rust/src/compiletest/compiletest.rs:252
    /home/ubuntu/rust/mk/tests.mk:756: recipe for target 'tmp/check-stage1-T-x86_64-unknown-linux-gnu-H-x86_64-unknown-linux-gnu-rpass.ok' failed
    make: *** [tmp/check-stage1-T-x86_64-unknown-linux-gnu-H-x86_64-unknown-linux-gnu-rpass.ok] Error 101

Backtrace:

#0  0x00007ffff6cb0267 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55  
#1  0x00007ffff6cb1eca in __GI_abort () at abort.c:89  
#2  0x00007ffff6ca903d in __assert_fail_base (fmt=0x7ffff6e0b028 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",   
    assertion=assertion@entry=0x7ffff1e75ca8 "Ty == resolve(Ty->getRef()) && \"type was not uniqued, possible ODR violation.\"", file=file@entry=0x7ffff1e75878 "/home/ubuntu/rust/src/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp",   
    line=line@entry=708,   
    function=function@entry=0x7ffff1e78300 <llvm::DwarfUnit::getOrCreateTypeDIE(llvm::MDNode const*)::__PRETTY_FUNCTION__> "llvm::DIE* llvm::DwarfUnit::getOrCreateTypeDIE(const llvm::MDNode*)") at assert.c:92  
#3  0x00007ffff6ca90f2 in __GI___assert_fail (  
    assertion=0x7ffff1e75ca8 "Ty == resolve(Ty->getRef()) && \"type was not uniqued, possible ODR violation.\"",   
    file=0x7ffff1e75878 "/home/ubuntu/rust/src/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp", line=708,   
    function=0x7ffff1e78300 <llvm::DwarfUnit::getOrCreateTypeDIE(llvm::MDNode const*)::__PRETTY_FUNCTION__> "llvm::DIE* llvm::DwarfUnit::getOrCreateTypeDIE(const llvm::MDNode*)") at assert.c:101  
#4  0x00007ffff0dcdd6e in llvm::DwarfUnit::getOrCreateTypeDIE(llvm::MDNode const*) ()  
   from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so  
#5  0x00007ffff0dcddb9 in llvm::DwarfUnit::addType(llvm::DIE&, llvm::DIType const*, llvm::dwarf::Attribute) ()  
   from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so  
#6  0x00007ffff0dce59a in llvm::DwarfUnit::constructTypeDIE(llvm::DIE&, llvm::DISubroutineType const*) ()  
   from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so  
#7  0x00007ffff0dcdc7a in llvm::DwarfUnit::getOrCreateTypeDIE(llvm::MDNode const*) ()  
   from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so  
#8  0x00007ffff0dcddb9 in llvm::DwarfUnit::addType(llvm::DIE&, llvm::DIType const*, llvm::dwarf::Attribute) ()  
   from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so  
#9  0x00007ffff0dcd3af in llvm::DwarfUnit::applySubprogramAttributes(llvm::DISubprogram const*, llvm::DIE&, bool) ()  
   from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so  
#10 0x00007ffff0da7962 in llvm::DwarfCompileUnit::applySubprogramAttributesToDefinition(llvm::DISubprogram const*, llvm::DIE&) () from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so  
#11 0x00007ffff0daebd2 in llvm::DwarfCompileUnit::constructAbstractSubprogramScopeDIE(llvm::LexicalScope*) ()  
   from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so  
#12 0x00007ffff0dbc4f5 in llvm::DwarfDebug::constructAbstractSubprogramScopeDIE(llvm::LexicalScope*) ()  
   from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so  
#13 0x00007ffff0dc210b in llvm::DwarfDebug::endFunction(llvm::MachineFunction const*) ()  
   from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so  
#14 0x00007ffff0d8dbe5 in llvm::AsmPrinter::EmitFunctionBody() ()  
   from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so  
#15 0x00007ffff0a925c6 in llvm::X86AsmPrinter::runOnMachineFunction(llvm::MachineFunction&) ()  
   from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so  
#16 0x00007ffff16b71a8 in llvm::FPPassManager::runOnFunction(llvm::Function&) ()  
   from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so  
#17 0x00007ffff16b7893 in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()  
   from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so  
#18 0x00007ffff047d095 in LLVMRustWriteOutputFile (Target=0x7fffe8085580, PMR=0x7fffe80211f0, M=0x7fffe8006220,   
    path=0x7fffed3f4b20 "x\326\034\356\377\177", FileType=llvm::TargetMachine::CGFT_ObjectFile)  
    at /home/ubuntu/rust/src/rustllvm/PassWrapper.cpp:249  
#19 0x00007ffff55de42a in rustc_trans::back::write::write_output_file (handler=0x7fffed3f84c8, target=0x7fffe8085580,   
    pm=0x7fffe80211f0, m=0x7fffe8006220, output=0x7fffec4e2d80, file_type=ObjectFileType)  
    at src/librustc_trans/back/write.rs:72  
#20 0x00007ffff55eb33f in fnfn (cpm=0x7fffe80211f0) at src/librustc_trans/back/write.rs:565  
#21 0x00007ffff55eb26e in rustc_trans::back::write::optimize_and_codegen::with_codegen<closure> (tm=0x7fffe8085580,   
    llmod=0x7fffe8006220, no_builtins=false, f={void (struct (*mut rustc_llvm::PassManager_opaque))} 0x7fffed3f4e68)  
    at src/librustc_trans/back/write.rs:533  
#22 0x00007ffff55ea9cb in fnfn () at src/librustc_trans/back/write.rs:564  
#23 0x00007ffff55ea0ed in rustc_trans::util::common::time<(),(),closure> (do_it=false, what=..., u=0,   
    f={void (struct (()))} 0x7fffed3f5460) at src/librustc/util/common.rs:39  
#24 0x00007ffff55e80ea in rustc_trans::back::write::optimize_and_codegen (cgcx=0x7fffed3f63c0, mtrans=..., config=...,   
    name_extra=..., output_names=...) at src/librustc_trans/back/write.rs:543  
#25 0x00007ffff55f2864 in rustc_trans::back::write::execute_work_item (cgcx=0x7fffed3f63c0, work_item=...)  
    at src/librustc_trans/back/write.rs:906  
#26 0x00007ffff55ef155 in rustc_trans::back::write::run_work_singlethreaded (sess=0x7fffed3f7c88, reachable=...,   
    work_items=...) at src/librustc_trans/back/write.rs:919  
#27 0x00007ffff55ebe6f in rustc_trans::back::write::run_passes (sess=0x7fffed3f7c88, trans=0x7fffed3f7968,   
    output_types=..., crate_output=0x7fffed3f7a10) at src/librustc_trans/back/write.rs:677
#28 0x00007ffff7a6c7fe in fnfn () at src/librustc_driver/driver.rs:767
#29 0x00007ffff7a6c432 in rustc_driver::util::common::time<(),(),closure> (do_it=false, what=..., u=0, 
    f={void (struct (()))} 0x7fffed3f74e8) at src/librustc/util/common.rs:39
#30 0x00007ffff78ed1fd in rustc_driver::driver::phase_5_run_llvm_passes (sess=0x7fffed3f7c88, trans=0x7fffed3f7968, 
    outputs=0x7fffed3f7a10) at src/librustc_driver/driver.rs:766
#31 0x00007ffff7844144 in rustc_driver::driver::compile_input (sess=..., cfg=..., input=0x7fffed3fdf98, 
    outdir=0x7fffed3fe110, output=0x7fffed3fe0f0, addl_plugins=..., control=...) at src/librustc_driver/driver.rs:168
#32 0x00007ffff7b096df in rustc_driver::run_compiler (args=..., callbacks=...) at src/librustc_driver/lib.rs:156
#33 0x00007ffff7b060fc in fnfn () at src/librustc_driver/lib.rs:99
#34 0x00007ffff7b052c9 in fnfn () at src/librustc_driver/lib.rs:806
#35 0x00007ffff7b051a6 in rustc_driver::boxed::F.FnBox<A>::call_box (self=0x7fffed43a060, args=0)
    at src/liballoc/boxed.rs:398
#36 0x00007ffff7b04a6f in rustc_driver::boxed::Box<FnBox<A, Output = R>+ Send + 'a>.FnOnce<A>::call_once (self=..., 
    args=0) at src/liballoc/boxed.rs:414
#37 0x00007ffff7b044cc in fnfn () at src/libstd/thread/mod.rs:349
#38 0x00007ffff7b0444f in rustc_driver::rt::unwind::try::try_fn<closure> (opt_closure=0x7fffed3fe8e8)
    at src/libstd/rt/unwind/mod.rs:158
#39 0x00007ffff7b043ea in rt::unwind::try::try_fn::h17428172142314623289 ()
   from x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-d8ace771.so
#40 0x00007ffff7332de9 in rust_try_inner () from x86_64-unknown-linux-gnu/stage1/lib/libstd-d8ace771.so
#41 0x00007ffff7332dd6 in rust_try () from x86_64-unknown-linux-gnu/stage1/lib/libstd-d8ace771.so
#42 0x00007ffff718fa30 in std::rt::unwind::try::inner_try (f={void (enum class c_void *)} 0x7fffed3fe8a8, 
    data=0x7fffed3fe8e8) at src/libstd/rt/unwind/mod.rs:147
#43 0x00007ffff7b04385 in rustc_driver::rt::unwind::try<closure> (f={void (())} 0x7fffed3fe900)
    at src/libstd/rt/unwind/mod.rs:130
#44 0x00007ffff7b0419d in fnfn () at src/libstd/thread/mod.rs:349
#45 0x00007ffff7b04ca1 in rustc_driver::boxed::F.FnBox<A>::call_box (self=0x7fffed424180, args=0)
    at src/liballoc/boxed.rs:398
#46 0x00007ffff71b0eaf in std::boxed::Box<FnBox<A, Output = R>+ 'a>.FnOnce<A>::call_once (self=..., args=0)
    at src/liballoc/boxed.rs:406
#47 0x00007ffff71b0de7 in std::sys_common::thread::start_thread (main=0x7fffed43b000)
    at src/libstd/sys/common/thread.rs:30
#48 0x00007ffff71e2d05 in std::sys::thread::Thread::new::thread_start (main=0x7fffed43b000)
    at src/libstd/sys/unix/thread.rs:77
#49 0x00007ffff71e2c85 in sys::thread::Thread::new::thread_start::hfcb7277d7665b775tKv ()
   from x86_64-unknown-linux-gnu/stage1/lib/libstd-d8ace771.so
#50 0x00007fffef6db6aa in start_thread (arg=0x7fffed3ff700) at pthread_create.c:333
#51 0x00007ffff6d81eed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
@steveklabnik steveklabnik added the A-testsuite Area: The testsuite used to check the correctness of rustc label Jun 23, 2015
@nagisa
Copy link
Member

nagisa commented Jul 11, 2015

I’ve hit this in both exactly this test and compiling a regular program (i.e. not a test) via cargo rustc -- -C lto.

@jdm jdm added the A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) label Jul 11, 2015
bors added a commit that referenced this issue Jul 21, 2015
fix `configure`: allow both `--enable-debug` and `--disable-debuginfo` in one invocation.

This is my very local fix to allow one to be able to (1.) build `rustc` and (2.) run `make check` with internal debug-mode *assertions* turned on in the presence of bugs like  #26447 and #26484 (both of which are solely caused by debuginfo and thus can be sidestepped via `--disable-debuginfo`).

This partially addresses #24416 (namely, it addresses the papercut outlined in the description of that ticket).  But there are other issues mentioned in the comment thread that are not addressed here, so they should be separately addressed before closing that ticket, or separate bugs should be opened for them.
@dotdash
Copy link
Contributor

dotdash commented Jul 28, 2015

This is caused by debuginfo generic enums. If you have e.g.:

fn main() {
    let x = Some(0);
}

debuginfo will be generated for the type Option<i32> and because the Option type comes from a different crate, it will use a dummy span, which effectively makes the debuginfo claim that the type was declared in this file. So for each crate you get a different debuginfo for that type and those clash during LTO.

dotdash added a commit to dotdash/rust that referenced this issue Aug 12, 2015
When using a generic enum type that was defined in an external crate,
our debuginfo currently claims that the concrete type (e.g. Option<i32>)
was defined in the current crate, where it was first used.

This means that if there are multiple crates that all use, for example,
Option<i32> values, they'll have conflicting debuginfo, each crate
claiming to have defined that type. This doesn't cause problems in
regular builds, but with LTO enabled, LLVM complains because it tries to
merge the debuginfo for those types and sees the ODR violations.

Since I couldn't find a way to get the file info for the external crate
that actually defined the enum, I'm working around the issue by using
"<unknown>" as the file for enum types. We'll want to re-visit and fix
this later, but this at least this fixes the ICE. And with the file
being unknown instead of wrong, the debuginfo isn't really worse than
before either.

Fixes rust-lang#26447
bors added a commit that referenced this issue Aug 16, 2015
When using a generic enum type that was defined in an external crate,
our debuginfo currently claims that the concrete type (e.g. Option<i32>)
was defined in the current crate, where it was first used.

This means that if there are multiple crates that all use, for example,
Option<i32> values, they'll have conflicting debuginfo, each crate
claiming to have defined that type. This doesn't cause problems in
regular builds, but with LTO enabled, LLVM complains because it tries to
merge the debuginfo for those types and sees the ODR violations.

Since I couldn't find a way to get the file info for the external crate
that actually defined the enum, I'm working around the issue by using
"<unknown>" as the file for enum types. We'll want to re-visit and fix
this later, but this at least this fixes the ICE. And with the file
being unknown instead of wrong, the debuginfo isn't really worse than
before either.

Fixes #26447
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-testsuite Area: The testsuite used to check the correctness of rustc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants