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
Created attachment 21212 [details] testcase
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)
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; }
*** Bug 43898 has been marked as a duplicate of this bug. ***
Similar testcase from PR43898: void bug() { struct Class { Class(int a) {} virtual void f() {} }; Class a(0); }
Mine anyway.
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.
Created attachment 22057 [details] refined patch Refined patch.
Hmhm, difficult. We're ending up with LANG_TYPE again in dealII, will add a testcase for that.
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
Fixed. After much pain.