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

Using both --enable-debug, --enable-optimization causes an assertion failure on build #26484

Closed
robertg opened this issue Jun 21, 2015 · 7 comments
Assignees
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.)

Comments

@robertg
Copy link

robertg commented Jun 21, 2015

If you do ./configure --enable-debug --enable-optimization, make will fail with:

rustc: x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/librustc
Assertion failed: (T == dwarf::DW_TAG_typedef || T == dwarf::DW_TAG_const_type || T == dwarf::DW_TAG_volatile_type || T == dwarf::DW_TAG_restrict_type || T == dwarf::DW_TAG_enumeration_type), function isUnsignedDIType, file /Users/rgawdzik/dev/rust/src/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp, line 525.
make: *** [x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib/stamp.rustc] Abort trap: 6

Fails on both mac, linux on master. This error does not occur if you only use --enable-debug or --enable-optimization exclusively.

@robertg robertg changed the title Using both --enable-debug, --enable-optimization causes an assertion failure Using both --enable-debug, --enable-optimization causes an assertion failure on build Jun 21, 2015
@jdm jdm added the A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) label Jun 21, 2015
@emberian
Copy link
Member

Repros for me as well, on:

CFG_LLVM_LINKAGE_FILE=/home/cmr/rust/build/x86_64-unknown-linux-gnu/rt/llvmdeps.rs LD_LIBRARY_PATH=/home/cmr/rust/build/x86_64-unknown-linux-gnu/stage1/lib:$LD_LIBRARY_PATH   x86_64-unknown-linux-gnu/stage1/bin/rustc --cfg stage1  -O --cfg rtopt -C debug-assertions=on -g -C prefer-dynamic --target=x86_64-unknown-linux-gnu  -D warnings -L "x86_64-unknown-linux-gnu/rt" -L "/home/cmr/rust/build/x86_64-unknown-linux-gnu/llvm/Release+Asserts/lib"    --out-dir x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib -C extra-filename=-d8ace771 ../src/librustc/lib.rs

@pnkfelix
Copy link
Member

pnkfelix commented Jul 3, 2015

yes I can reproduce this locally as well (thought it was somehow related to my own branch, glad I checked against master as well...)

@pnkfelix
Copy link
Member

pnkfelix commented Jul 9, 2015

This was injected by f9d4149 (PR #26025), an LLVM upgrade. (I identified this via bisection, though it is a pretty obvious candidate for the cause in hindsight.)

cc @alexcrichton @michaelwoerister

@pnkfelix
Copy link
Member

pnkfelix commented Jul 9, 2015

backtrace from the assert under lldb on OS X : https://gist.github.com/pnkfelix/13851983520628197add

@pnkfelix
Copy link
Member

pnkfelix commented Jul 9, 2015

(lldb) 
frame #5: 0x00000001030bdeed librustc_llvm-7e44814b.dylib`isUnsignedDIType(DD=0x00000001c0d18400, Ty=0x0000000189547d00) + 349 at DwarfUnit.cpp:522
   519          T == dwarf::DW_TAG_structure_type ||
   520          T == dwarf::DW_TAG_union_type)
   521        return true;
-> 522      assert(T == dwarf::DW_TAG_typedef || T == dwarf::DW_TAG_const_type ||
   523             T == dwarf::DW_TAG_volatile_type ||
   524             T == dwarf::DW_TAG_restrict_type ||
   525             T == dwarf::DW_TAG_enumeration_type);
(lldb) p T
(llvm::dwarf::Tag) $0 = DW_TAG_subroutine_type

@pnkfelix
Copy link
Member

(reduced test case here: https://gist.github.com/pnkfelix/268609f5a2e88cddac63 )

@michaelwoerister
Copy link
Member

Yuck, these kinds bugs always take days to properly track down :P

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.
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.)
Projects
None yet
Development

No branches or pull requests

6 participants