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

rustc: "error: internal compiler error: debuginfo::set_members_of_composite_type() - Already completed forward declaration re-encountered." #14411

Closed
a-p- opened this issue May 25, 2014 · 12 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@a-p-
Copy link

a-p- commented May 25, 2014

Versions:

$ rustc --version
rustc 0.11.0-pre (11aa731 2014-05-23 14:56:24 -0700)
host: x86_64-unknown-linux-gnu
$ uname -a
Linux test 3.13-1-amd64 #1 SMP Debian 3.13.10-1 (2014-04-15) x86_64 GNU/Linux

Code to reproduce the ICE:

fn test(a: &Vec<u8>) {
  print!("{}", a.len());
}

pub fn main() {
  let data = vec!();
  test(&data);
}

Compilation output (assuming code is in test.rs):

$ RUST_BACKTRACE=1 rustc -g test.rs 
test.rs:1:1: 1:1 error: internal compiler error: debuginfo::set_members_of_composite_type() - Already completed forward declaration re-encountered.
test.rs:1 fn test(a: &Vec<u8>) {
          ^
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /tmp/rust/src/libsyntax/diagnostic.rs:106
stack backtrace:
   1:     0x7f6088d547b0 - rt::backtrace::imp::write::h91511e92fbebf61dJSy::v0.11.0.pre
   2:     0x7f6088cd4900 - rt::unwind::begin_unwind_inner::hc6a3eade6662bd0cRsy::v0.11.0.pre
   3:     0x7f60876d4cb0 - rt::unwind::begin_unwind::h14424584252031250192::v0.11.0.pre
   4:     0x7f60876d4be0 - diagnostic::SpanHandler::span_bug::hbb40ab336641d6bcoUb::v0.11.0.pre
   5:     0x7f6089823d00 - driver::session::Session::span_bug::hbc579a9c1652b4dcWQk::v0.11.0.pre
   6:     0x7f608992a540 - middle::trans::debuginfo::set_members_of_composite_type::ha39f45d6f9c0cb39stB::v0.11.0.pre
   7:     0x7f6089928e50 - middle::trans::debuginfo::RecursiveTypeDescription::finalize::h0fe21aef99d3e1c0I8A::v0.11.0.pre
   8:     0x7f608991d440 - middle::trans::debuginfo::type_metadata::h98963d42bb116c2fCVB::v0.11.0.pre
   9:     0x7f608991d440 - middle::trans::debuginfo::type_metadata::h98963d42bb116c2fCVB::v0.11.0.pre
  10:     0x7f6089932ee0 - middle::trans::debuginfo::vec_slice_metadata::h5b5525bc44b17f0dCKB::v0.11.0.pre
  11:     0x7f608991d440 - middle::trans::debuginfo::type_metadata::h98963d42bb116c2fCVB::v0.11.0.pre
  12:     0x7f6089921730 - middle::trans::debuginfo::declare_local::h3f3d7f3d971eec2bBLA::v0.11.0.pre
  13:     0x7f6089920a10 - middle::trans::debuginfo::create_local_var_metadata::closure.63979
  14:     0x7f6089d15cc0 - middle::pat_util::pat_bindings::closure.76254
  15:     0x7f608771bcd0 - ast_util::walk_pat::h73d09c5bbd81fc4aBNv::v0.11.0.pre
  16:     0x7f60897fbbd0 - middle::trans::controlflow::trans_stmt::hebe30cb187b2a930B2a::v0.11.0.pre
  17:     0x7f60897fdcb0 - middle::trans::controlflow::trans_block::hc64c9e56aa358790I7a::v0.11.0.pre
  18:     0x7f608983e730 - middle::trans::expr::trans_rvalue_dps_unadjusted::h9c3393158ea8f3e88hf::v0.11.0.pre
  19:     0x7f60897fd5a0 - middle::trans::expr::trans_into::h6b67f346e56d2aaagse::v0.11.0.pre
  20:     0x7f60898ee990 - middle::trans::_match::trans_match_inner::he680468c7e8edd8bk7s::v0.11.0.pre
  21:     0x7f608983e730 - middle::trans::expr::trans_rvalue_dps_unadjusted::h9c3393158ea8f3e88hf::v0.11.0.pre
  22:     0x7f60897fd5a0 - middle::trans::expr::trans_into::h6b67f346e56d2aaagse::v0.11.0.pre
  23:     0x7f60897fc780 - middle::trans::controlflow::trans_stmt_semi::h95ab3162fcdb8669P6a::v0.11.0.pre
  24:     0x7f60897fbbd0 - middle::trans::controlflow::trans_stmt::hebe30cb187b2a930B2a::v0.11.0.pre
  25:     0x7f60897fdcb0 - middle::trans::controlflow::trans_block::hc64c9e56aa358790I7a::v0.11.0.pre
  26:     0x7f60898bb6c0 - middle::trans::base::trans_closure::hd893efe09250c8a3Php::v0.11.0.pre
  27:     0x7f60897c6df0 - middle::trans::base::trans_fn::h02396ab03da5196a5pp::v0.11.0.pre
  28:     0x7f60897c1110 - middle::trans::base::trans_item::h4715e8b19ebc5b3eCBp::v0.11.0.pre
  29:     0x7f60898ca380 - middle::trans::base::trans_crate::h97a887f98edb0d3dpoq::v0.11.0.pre
  30:     0x7f608a0a1430 - driver::driver::phase_4_translate_to_llvm::h29f793bbb3691a0c01j::v0.11.0.pre
  31:     0x7f608a096b40 - driver::driver::compile_input::hf7a007097756b7ceBJj::v0.11.0.pre
  32:     0x7f608a160180 - driver::run_compiler::h6c18401fac048ee4umm::v0.11.0.pre
  33:     0x7f608a1600a0 - driver::main_args::closure.93487
  34:     0x7f608a174b50 - driver::monitor::closure.94559
  35:     0x7f608a170070 - task::TaskBuilder::try::closure.94322
  36:     0x7f608926c970 - task::spawn_opts::closure.7801
  37:     0x7f6088d4e6e0 - rt::task::Task::run::closure.25256
  38:     0x7f6088dadab0 - rust_try
  39:     0x7f6088d4e630 - rt::task::Task::run::h9a36fd2f34280279uhw::v0.11.0.pre
  40:     0x7f608926c720 - task::spawn_opts::closure.7774
  41:     0x7f6088d52b60 - rt::thread::thread_start::h057270a612f2c73020w::v0.11.0.pre
  42:     0x7f60867fdfa0 - start_thread
  43:     0x7f608899cbe9 - __clone
  44:                0x0 - <unknown>

$ 

This might be related to issue #14385.

@jdm
Copy link
Contributor

jdm commented May 25, 2014

Curiously, I can't reproduce this:

[jdm@rosencrantz tmp]$ ~/Downloads/rust-nightly-x86_64-unknown-linux-gnu/bin/rustc --version ice.rs
rustc 0.11.0-pre-nightly (33c3edd 2014-05-23 00:31:27 -0700)
host: x86_64-unknown-linux-gnu
[jdm@rosencrantz tmp]$ ~/Downloads/rust-nightly-x86_64-unknown-linux-gnu/bin/rustc -g ice.rs
[jdm@rosencrantz tmp]$

@michaelwoerister
Copy link
Member

Thanks for filing this, @a-p-! This probably is a duplicate of the other issue you mentioned, but let's leave it open for the time being, since the error messages do look a bit different.

bors added a commit that referenced this issue May 29, 2014
So far the DWARF information for enums was different for regular enums, univariant enums, Option-like enums, etc. Regular enums were encoded as unions of structs, while the other variants were encoded as bare structs. With the changes in this PR all enums are encoded as unions so that debuggers can reconstruct if something originally was a struct, a univariant enum, or an Option-like enum.  For the latter case, information about the *Null* variant is encoded into the union field name. This information can then be used by the debugger to print a `None` value actually as `None` instead of `Some(0x0)`.

The changes in this PR should also fix the regression reported in #14385 and #14411, but I want to close these only after I have confirmation from the original reporters that the issues are actually fixed for them.
@michaelwoerister
Copy link
Member

@a-p- Would you care to take a look if this issue still occurs for you with a recent rustc version? Pull request #14486 should have improved the situation here.

@a-p-
Copy link
Author

a-p- commented Jun 5, 2014

@michaelwoerister Hello, I've tried with a new build of a recent version of rustc, but still get an ICE:

$ /opt/rust/bin/rustc --version
rustc 0.11.0-pre (0c74911 2014-06-05 00:51:48 -0700)
host: x86_64-unknown-linux-gnu
$ uname -a
Linux test 3.14-1-amd64 #1 SMP Debian 3.14.4-1 (2014-05-13) x86_64 GNU/Linux
$ RUST_BACKTRACE=1 /opt/rust/bin/rustc -g test.rs 
test.rs:1:1: 1:1 error: internal compiler error: debuginfo::set_members_of_composite_type() - Already completed forward declaration re-encountered.
test.rs:1 fn test(a: &Vec<u8>) {
          ^
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /tmp/rust/src/libsyntax/diagnostic.rs:106
stack backtrace:
   1:     0x7fb260921110 - rt::backtrace::imp::write::h5b011fbced4690bc0vx::v0.11.0.pre
   2:     0x7fb2608ab760 - rt::unwind::begin_unwind_inner::h4995bd0c39c49d8415w::v0.11.0.pre
   3:     0x7fb25f699340 - rt::unwind::begin_unwind::h18387254772016977913::v0.11.0.pre
   4:     0x7fb25f699270 - diagnostic::SpanHandler::span_bug::h1ebafc0cc5381e817Yb::v0.11.0.pre
   5:     0x7fb26140ca00 - driver::session::Session::span_bug::h3cb0e5e4a1a58907iAn::v0.11.0.pre
   6:     0x7fb261519830 - middle::trans::debuginfo::set_members_of_composite_type::h9d6b6d26b490c2fdSJB::v0.11.0.pre
   7:     0x7fb261518180 - middle::trans::debuginfo::RecursiveTypeDescription::finalize::hfc1025fa8d8596bezdB::v0.11.0.pre
   8:     0x7fb26150c430 - middle::trans::debuginfo::type_metadata::h26dd280d0653fbfa9bC::v0.11.0.pre
   9:     0x7fb26150c430 - middle::trans::debuginfo::type_metadata::h26dd280d0653fbfa9bC::v0.11.0.pre
  10:     0x7fb2615228d0 - middle::trans::debuginfo::vec_slice_metadata::h0ec8841b6b25512f20B::v0.11.0.pre
  11:     0x7fb26150c430 - middle::trans::debuginfo::type_metadata::h26dd280d0653fbfa9bC::v0.11.0.pre
  12:     0x7fb2615104c0 - middle::trans::debuginfo::declare_local::h9ad0c49244a464fcqVA::v0.11.0.pre
  13:     0x7fb26150f7a0 - middle::trans::debuginfo::create_local_var_metadata::closure.65228
  14:     0x7fb261908ce0 - middle::pat_util::pat_bindings::closure.77495
  15:     0x7fb25f6e3530 - ast_util::walk_pat::hfb30fd5660745952G8v::v0.11.0.pre
  16:     0x7fb2613e4c40 - middle::trans::controlflow::trans_stmt::h71e5e3cdf054599bX0a::v0.11.0.pre
  17:     0x7fb2613e6d20 - middle::trans::controlflow::trans_block::h781cb455d116b1e645a::v0.11.0.pre
  18:     0x7fb2614273f0 - middle::trans::expr::trans_rvalue_dps_unadjusted::h159ddfe7ad51b9ebBaf::v0.11.0.pre
  19:     0x7fb2613e6610 - middle::trans::expr::trans_into::hcac93d6d00849afdJke::v0.11.0.pre
  20:     0x7fb2614dca80 - middle::trans::_match::trans_match_inner::h28ab07adb784f590Bbt::v0.11.0.pre
  21:     0x7fb2614273f0 - middle::trans::expr::trans_rvalue_dps_unadjusted::h159ddfe7ad51b9ebBaf::v0.11.0.pre
  22:     0x7fb2613e6610 - middle::trans::expr::trans_into::hcac93d6d00849afdJke::v0.11.0.pre
  23:     0x7fb2613e57f0 - middle::trans::controlflow::trans_stmt_semi::h3f66501f21849971b5a::v0.11.0.pre
  24:     0x7fb2613e4c40 - middle::trans::controlflow::trans_stmt::h71e5e3cdf054599bX0a::v0.11.0.pre
  25:     0x7fb2613e6d20 - middle::trans::controlflow::trans_block::h781cb455d116b1e645a::v0.11.0.pre
  26:     0x7fb2614a8000 - middle::trans::base::trans_closure::h5f727b60571a9bceM7o::v0.11.0.pre
  27:     0x7fb2613af740 - middle::trans::base::trans_fn::h82bf58d3dcfe40ed9fp::v0.11.0.pre
  28:     0x7fb2613a8a40 - middle::trans::base::trans_item::hf8978f932565ffa2Xwp::v0.11.0.pre
  29:     0x7fb2614b81a0 - middle::trans::base::trans_crate::hc6f568a97ee25e04Ypq::v0.11.0.pre
  30:     0x7fb261c992b0 - driver::driver::phase_4_translate_to_llvm::h182ce6d3422188faZKm::v0.11.0.pre
  31:     0x7fb261c8e9c0 - driver::driver::compile_input::h4d9d1d436c03b1d3Asm::v0.11.0.pre
  32:     0x7fb261d59880 - driver::main_args::closure.94807
  33:     0x7fb261d6e5a0 - driver::monitor::closure.95878
  34:     0x7fb261d69ac0 - task::TaskBuilder::try::closure.95641
  35:     0x7fb260e50a90 - task::spawn_opts::closure.7844
  36:     0x7fb26091b110 - rt::task::Task::run::closure.25203
  37:     0x7fb2609803c0 - rust_try
  38:     0x7fb26091b060 - rt::task::Task::run::h1c418364160adcf9FUu::v0.11.0.pre
  39:     0x7fb260e50840 - task::spawn_opts::closure.7817
  40:     0x7fb26091f430 - rt::thread::thread_start::hbbafda47cc55f18ddEv::v0.11.0.pre
  41:     0x7fb25e3b8000 - start_thread
  42:     0x7fb260569fc9 - __clone
  43:                0x0 - <unknown>

$ 

I've also tried with a nightly build, but it does not give an ICE, however:

$ /tmp/rust-nightly-x86_64-unknown-linux-gnu/bin/rustc --version
rustc 0.11.0-pre-nightly (d130acc 2014-06-03 23:51:41 -0700)
host: x86_64-unknown-linux-gnu
$ /tmp/rust-nightly-x86_64-unknown-linux-gnu/bin/rustc -g test.rs 
$ 

The build that results in the ICE was compiled using Clang and linked using gold:

$ echo $CC
clang
$ echo $CFLAGS
-O3 -ggdb
$ $CC --version
Debian clang version 3.4.1-4 (tags/RELEASE_34/dot1-final) (based on LLVM 3.4.1)
Target: x86_64-pc-linux-gnu
Thread model: posix
$ echo $CXX
clang++
$ echo $CXXFLAGS
-O3 -ggdb
$ $CXX --version
Debian clang version 3.4.1-4 (tags/RELEASE_34/dot1-final) (based on LLVM 3.4.1)
Target: x86_64-pc-linux-gnu
Thread model: posix
$ echo $LD
gold
$ $LD --version
GNU gold (GNU Binutils for Debian 2.24.51.20140604) 1.11
Copyright (C) 2014 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
$ 

Rust's configure script was executed like:

$ ./configure --prefix=/opt/rust --enable-clang --llvm-root=/usr

The llvm-config script reports:

$ /usr/bin/llvm-config --version --prefix --build-mode
3.3
/usr/lib/llvm-3.3
Release
$ 

@michaelwoerister
Copy link
Member

I'd like to confirm that this is solved, but I get linker errors when I try to compile rustc with LLVM 3.3. @alexcrichton, do we officially support LLVM 3.3?

An excerpt of the errors I'm getting on OSX:

Undefined symbols for architecture x86_64:
  "std::ios_base::ios_base()", referenced from:
      llvm::BallLarusNode::getName() in libLLVMAnalysis.a(PathNumbering.o)
  "std::locale::locale()", referenced from:
      llvm::BallLarusNode::getName() in libLLVMAnalysis.a(PathNumbering.o)
  "std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*)", referenced from:
      llvm::BallLarusNode::getName() in libLLVMAnalysis.a(PathNumbering.o)
  "std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)", referenced from:
      llvm::BallLarusNode::getName() in libLLVMAnalysis.a(PathNumbering.o)

@alexcrichton
Copy link
Member

We don't necessarily officially support LLVM 3.3, but it is very nice to support LLVM 3.3! Is the linker error a result of a change you made, or is it the state of master today?

@michaelwoerister
Copy link
Member

This is master from just now. I'm currently in the process of trying it out on linux.

@alexcrichton
Copy link
Member

Hm that is suspicious. It looks like it's something that should be relatively easy to fix, but I'm not certain to the cause just by looking at it.

@michaelwoerister
Copy link
Member

Maybe my local system is messed up somehow. I wouldn't give my "bug report" just too much weight yet :)

@michaelwoerister
Copy link
Member

OK, on Linux do not get any errors when compiling rustc with an out-of-tree LLVM 3.3 installation. I'll add the test case from the OP to the debuginfo test suite.

@michaelwoerister
Copy link
Member

@a-p- Would you mind trying it out again? Locally I cannot reproduce the error anymore.

alexcrichton added a commit to alexcrichton/rust that referenced this issue Jun 19, 2014
Closes rust-lang#14480 (vim: Add :RustRun and associated commands)
Closes rust-lang#14917 (Deprecate free-standing endian conversions in favor of methods on Int. Merge Bitwise into Int and add more bit operations.)
Closes rust-lang#14981 (librustc: Use expr_ty_adjusted in trans_overloaded_call.)
Closes rust-lang#14989 (std::task - Revamp TaskBuilder API)
Closes rust-lang#14997 (Reject double moves out of array elements)
Closes rust-lang#14998 (Vim: highlight escapes for byte literals.)
Closes rust-lang#15002 (Fix FIXME rust-lang#5275)
Closes rust-lang#15004 (Fix rust-lang#14865)
Closes rust-lang#15007 (debuginfo: Add test case for issue rust-lang#14411.)
Closes rust-lang#15012 ((doc) Change search placeholder text.)
Closes rust-lang#15013 (Update compiler-rt.)
Closes rust-lang#15017 (Deprecate the bytes!() macro.)
@michaelwoerister
Copy link
Member

I'm closing this issue. It's really a duplicate of #14385 which has been confirmed as fixed.

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.) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

5 participants