This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug debug/41063] New: ICE in output_die


Compile the following with -g for a DWARF target:

$ cat test.cc
struct A {
  virtual void run();
};

void test() {
  struct B : public A {
    void run() {
      struct C : public A {
        C() { }
        B *b_;
      };
      C c;
    }
  };
  B b;
}

$ gcc -v
Reading specs from /home/ccoutant/opensource/gcc-trunk/build-native/gcc/specs
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc/configure --enable-languages=c,c++ --disable-bootstrap
: (reconfigured) ../gcc/configure --disable-bootstrap --enable-languages=c,c++
--no-create --no-recursion
Thread model: posix
gcc version 4.5.0 20090727 (experimental) (GCC) 

$ gcc -g -c test.cc
test.cc:16:1: internal compiler error: in output_die, at dwarf2out.c:8845
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


By the time we get to dwarf2out_finish(), the DIE graph has a cycle in it:

 struct B -> subprogram run -> struct C -> struct B -> ...

It seems to have put the DIE for struct B as a child of struct C instead of the
DIE for "pointer to B".

Because of the cycle, none of the DIEs involved are placed in the main compunit
tree. The DIE for the type "pointer to B" (which did make it into the main
tree) tries to reference the DIE for the type B, which is part of the cycle,
and triggers the assertion.

When the vtable for struct C is output from note_debug_info_needed(), a DIE for
struct B has not been built yet. When gen_type_die_with_usage() sees the
pointer to B, it then calls itself recursively to generate the DIE for B, but
it passes the same context that it was given, which is the lexical block inside
B::run(), and struct B is then created as a child of that lexical block, thus
forming the cycle.


-- 
           Summary: ICE in output_die
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ccoutant at gcc dot gnu dot org
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41063


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]