Bug 44950 - ICE in dwarf2out_finish, at dwarf2out.c:22271
Summary: ICE in dwarf2out_finish, at dwarf2out.c:22271
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Richard Biener
URL:
Keywords: lto
: 43898 (view as bug list)
Depends on:
Blocks: mozillametabug
  Show dependency treegraph
 
Reported: 2010-07-15 14:40 UTC by Jan Hubicka
Modified: 2010-10-18 10:54 UTC (History)
3 users (show)

See Also:
Host: x86_64-linux
Target: x86_64-linux
Build: x86_64-linux
Known to work:
Known to fail:
Last reconfirmed: 2010-07-23 10:25:17


Attachments
testcase (145.92 KB, text/plain)
2010-07-15 15:22 UTC, Jan Hubicka
Details
patch (684 bytes, patch)
2010-10-15 19:41 UTC, Richard Biener
Details | Diff
refined patch (971 bytes, patch)
2010-10-15 21:01 UTC, Richard Biener
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Hubicka 2010-07-15 14:40:54 UTC
jh@evans:/abuild/jh/build-mozilla-debug/js/src/shell> /abuild/jh/trunk-install/bin/g++ -fwhopr=24 -fuse-linker-plugin  -fpermissive -o js.o -c  -I../../../dist/system_wrappers_js -include /abuild/jh/mozilla-central/js/src/config/gcc_hidden.h -DEXPORT_JS_API -DOSTYPE=\"Linux2.6.32.12-0\" -DOSARCH=Linux -I/abuild/jh/mozilla-central/js/src -I.. -I/abuild/jh/mozilla-central/js/src/shell -I. -I../../../dist/include -I../../../dist/include/nsprpub  -I/abuild/jh/build-mozilla-debug/dist/include/nspr    -fPIC  -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -pedantic -Wno-long-long -fno-strict-aliasing -pthread -pipe  -DNDEBUG -DTRIMMED -g -Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer    -DMOZILLA_CLIENT -include ../js-confdefs.h -MD -MF .deps/js.pp /abuild/jh/mozilla-central/js/src/shell/js.cpp -E >js.ii
jh@evans:/abuild/jh/build-mozilla-debug/js/src/shell> /abuild/jh/trunk-install/bin/g++ -fwhopr=24 -fuse-linker-plugin -r -nostdlib js.ii -g
jh@evans:/abuild/jh/build-mozilla-debug/js/src/shell> mv js.o js.ii
jh@evans:/abuild/jh/build-mozilla-debug/js/src/shell> /abuild/jh/trunk-install/bin/g++ -fwhopr=24 -fuse-linker-plugin -r -nostdlib js.ii -g
In file included from /abuild/jh/mozilla-central/js/src/shell/js.cpp:61:0:
/abuild/jh/mozilla-central/js/src/jscntxt.h: In function ‘JSContext* js_ContextFromLinkField(JSCList*)’:
/abuild/jh/mozilla-central/js/src/jscntxt.h:2704:75: warning: invalid access to non-static data member ‘JSContext::link’  of NULL object [-Winvalid-offsetof]
/abuild/jh/mozilla-central/js/src/jscntxt.h:2704:75: warning: (perhaps the ‘offsetof’ macro was used incorrectly) [-Winvalid-offsetof]
lto1: internal compiler error: in dwarf2out_finish, at dwarf2out.c:22272
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [/abuild/jh/tmp/ccRqAsbV.ltrans0.ltrans.o] Error 1
lto-wrapper: make returned 2 exit status
Comment 1 Jan Hubicka 2010-07-15 15:22:00 UTC
Created attachment 21212 [details]
testcase
Comment 2 Richard Biener 2010-07-23 10:25:16 UTC
Reduced testcase:

struct JSContext;
struct JSObject;
class WorkerHooks {
    virtual JSObject *newGlobalObject(JSContext *cx) = 0;
};
int
shell(JSContext *cx, int argc, char **argv, char **envp)
{
  class ShellWorkerHooks : public WorkerHooks {
      JSObject *newGlobalObject(JSContext *cx) { }
  };
  ShellWorkerHooks hooks;
}

> ./g++ -B. -flto -r -nostdlib -g js.3.ii
lto1: internal compiler error: in dwarf2out_finish, at dwarf2out.c:22271
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
lto-wrapper: ./g++ returned 1 exit status
collect2: lto-wrapper returned 1 exit status

#1  0x00000000005d46a8 in dwarf2out_finish (filename=0x1664040 "js.3.o")
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:22269
22269                 gcc_assert (context
22270                             && (TREE_CODE (context) == FUNCTION_DECL
22271                                 || TREE_CODE (context) == NAMESPACE_DECL));
(gdb) p context->base.code
$2 = RECORD_TYPE

(gdb) call debug_generic_expr (node->created_for)
__base_ctor

(for ShellWorkerHooks)
Comment 3 Richard Biener 2010-07-23 18:24:57 UTC
Without LTO the limbo DIE has a non-NULL get_AT_ref (die, DW_AT_abstract_origin),
a DW_TAG_subprogram.  For some reason that doesn't get created with LTO
(not easy to follow why).

More reduced testcase:

struct Base { ~Base (); };
void fun(void) { struct Deriv : Base { } x; }
Comment 4 Richard Biener 2010-07-23 18:51:43 UTC
*** Bug 43898 has been marked as a duplicate of this bug. ***
Comment 5 Richard Biener 2010-07-23 18:53:16 UTC
Similar testcase from PR43898:

 void bug() {
   struct Class {
     Class(int a) {}
     virtual void f() {}
   };
   Class a(0);
 }
Comment 6 Richard Biener 2010-10-12 09:00:32 UTC
Mine anyway.
Comment 7 Richard Biener 2010-10-15 19:41:42 UTC
Created attachment 22055 [details]
patch

The DIE for the abstract origin needs to be created for the member function
when emitting the debuginfo for the class type.  We can't not do that and
still refer to it.

The patch avoids clearing TYPE_METHODS.  We could also stream it lazily
iff it is not possibly shared between instances.
Comment 8 Richard Biener 2010-10-15 21:01:08 UTC
Created attachment 22057 [details]
refined patch

Refined patch.
Comment 9 Richard Biener 2010-10-16 10:03:59 UTC
Hmhm, difficult.  We're ending up with LANG_TYPE again in dealII, will add
a testcase for that.
Comment 10 Richard Biener 2010-10-18 10:54:21 UTC
Author: rguenth
Date: Mon Oct 18 10:54:18 2010
New Revision: 165629

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=165629
Log:
2010-10-18  Richard Guenther  <rguenther@suse.de>

	PR lto/44950
	* tree.c (free_lang_data_in_decl): As we clear TYPE_METHODS
	also clear references to entries of it.

	* g++.dg/lto/20101015-2_0.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/lto/20101015-2_0.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree.c
Comment 11 Richard Biener 2010-10-18 10:54:46 UTC
Fixed.  After much pain.