gcc -v Using built-in specs. COLLECT_GCC=/usr/bin/gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/ppc64-redhat-linux/4.7.0/lto-wrapper Target: ppc64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --disable-build-with-cxx --disable-build-poststage1-with-cxx --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --enable-secureplt --with-long-double-128 --build=ppc64-redhat-linux --target=ppc64-redhat-linux --with-cpu=default32 Thread model: posix gcc version 4.7.0 20120308 (Red Hat 4.7.0-0.19) (GCC) g++ -c -pipe -Wall -Wreturn-type -fno-strict-aliasing -Wcast-align -Wchar-subscripts -Wformat-security -Wreturn-type -Wno-unused-parameter -Wno-sign-compare -Wno-switch -Wno-switch-enum -Wundef -Wmissingnit-self -fno-stack-protector -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m32 -O2 -fvisibility=hidden -fvisibility-inlines-hidden -D_REENTRANT -fPIC -DQT_SHARED -DJSC=QTJSC -Djscyyparse=qtjscyyparse -Djscyylex=qtjscyylex -Djscyyerror=qtjscyyerror -DWTF=QTWTF -DQT_BUILD_SCRIPT_LIB -DQT_NO_USING_NAMESPACE -DQLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT3_SUPPORT -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DBUILDING_QT__=1 -DWTF_USE_ACCELERATED_COMPOSITING -DNDEBUG -DBUILDING_QT__ -DBUILDING_JavaScriptCore -DBUILDING_WTF -DWTF_USE_JAVASCRIPTCORE_BINDINGS=1 -DWTF_CHANGES=1 -DNDEBUG -DJS_NO_EXPORT -DQT_NO_DEBUG -DQT_CORE_LIB -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../mkspecs/linux-g++ -I. -I../../include/QtCore -I../../include -I../3rdparty/javascriptcore/JavaScriptCore -I../3rdparty/javascriptcore -I../3rdparty/javascriptcore/JavaScriptCore/assembler -I../3rdparty/javascriptcore/JavaScriptCore/bytecode -I../3rdparty/javascriptcore/JavaScriptCore/bytecompiler -I../3rdparty/javascriptcore/JavaScriptCore/debugger -I../3rdparty/javascriptcore/JavaScriptCore/interpreter -I../3rdparty/javascriptcore/JavaScriptCore/jit -I../3rdparty/javascriptcore/JavaScriptCore/parser -I../3rdparty/javascriptcore/JavaScriptCore/pcre -I../3rdparty/javascriptcore/JavaScriptCore/profiler -I../3rdparty/javascriptcore/JavaScriptCore/runtime -I../3rdparty/javascriptcore/JavaScriptCore/wrec -I../3rdparty/javascriptcore/JavaScriptCore/wtf -I../3rdparty/javascriptcore/JavaScriptCore/wtf/symbian -I../3rdparty/javascriptcore/JavaScriptCore/wtf/unicode -I../3rdparty/javascriptcore/JavaScriptCore/yarr -I../3rdparty/javascriptcore/JavaScriptCore/API -I../3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders -I../3rdparty/javascriptcore/JavaScriptCore/generated -I../../include/QtScript -I.rcc/release-shared -I/builddir/build/BUILD/qt-everywhere-opensource-src-4.8.0/src/3rdparty/javascriptcore/WebKit/qt/Api -I../3rdparty/javascriptcore/JavaScriptCore/pcre -I/builddir/build/BUILD/qt-everywhere-opensource-src-4.8.0/src/3rdparty/javascriptcore/JavaScriptCore/tmp -I../3rdparty/javascriptcore/JavaScriptCore -I../3rdparty/javascriptcore/JavaScriptCore/parser -I../3rdparty/javascriptcore/JavaScriptCore/bytecompiler -I../3rdparty/javascriptcore/JavaScriptCore/debugger -I../3rdparty/javascriptcore/JavaScriptCore/runtime -I../3rdparty/javascriptcore/JavaScriptCore/wtf -I/builddir/build/BUILD/qt-everywhere-opensource-src-4.8.0/src/script/../3rdparty/javascriptcore/JavaScriptCore/unicode -I../3rdparty/javascriptcore/JavaScriptCore/interpreter -I../3rdparty/javascriptcore/JavaScriptCore/jit -I../3rdparty/javascriptcore/JavaScriptCore/profiler -I../3rdparty/javascriptcore/JavaScriptCore/wrec -I../3rdparty/javascriptcore/JavaScriptCore/API -I../3rdparty/javascriptcore/JavaScriptCore/bytecode -I../3rdparty/javascriptcore/JavaScriptCore/assembler -I../3rdparty/javascriptcore/JavaScriptCore/generated -I. -Iparser -I.moc/release-shared -o obj/release/JSGlobalData.o ../3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.cpp ../3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.cpp: In static member function 'static void QTJSC::JSGlobalData::storeVPtrs()': ../3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.cpp:92:27: internal compiler error: Segmentation fault
Created attachment 26886 [details] gzip compressed preprocessed source
Strange, with the 4.7-RH cc1plus I can reproduce the segfault even on inline void *operator new (__SIZE_TYPE__, void *p) throw () { return p; } struct B { virtual ~B (); B (); }; struct A : B { A () : B () {} virtual void bar (); }; void foo () { char a[64]; B *b = new (&a) A (); b->~B (); } (at -O2, both -m32 and -m64), but I can't reproduce it with a cross from x86_64-linux to powerpc64-linux.
Ah, #define HAVE_AS_GNU_ATTRIBUTE 1 in auto-host.h is essential for this. This is devirt in action, for some reason the devirtualized A::~A () doesn't have DECL_EXTERNAL set (not sure what should set it, the FE, the devirtualizer?) and likely the rs6000 backend just should be more forgiving and if it can't find a cgraph node, IMHO call_ABI_of_interest should just return true as a conservative answer. So, for 4.7.0 IMHO best would be to do: --- gcc/config/rs6000/rs6000.c 2012-03-13 19:58:59.342625117 +0100 +++ gcc/config/rs6000/rs6000.c 2012-03-13 23:14:15.693828006 +0100 @@ -7452,6 +7452,9 @@ call_ABI_of_interest (tree fndecl) /* Interesting functions that we are emitting in this object file. */ c_node = cgraph_get_node (fndecl); c_node = cgraph_function_or_thunk_node (c_node, NULL); + if (c_node == NULL) + return true; + return !cgraph_only_called_directly_p (c_node); } return false; and for 4.7.1/4.8 (while this can perhaps stay) we should find out why DECL_EXTERNAL isn't set.
Does Index: gcc/gimple-fold.c =================================================================== --- gcc/gimple-fold.c (revision 185376) +++ gcc/gimple-fold.c (working copy) @@ -143,6 +143,8 @@ canonicalize_constructor_val (tree cval) if (cfun && gimple_referenced_vars (cfun)) add_referenced_var (base); } + else if (base && TREE_CODE (base) == FUNCTION_DECL) + cgraph_get_create_node (base); /* Fixup types in global initializers. */ if (TREE_TYPE (TREE_TYPE (cval)) != TREE_TYPE (TREE_OPERAND (cval, 0))) cval = build_fold_addr_expr (TREE_OPERAND (cval, 0)); @@ -3115,6 +3117,11 @@ gimple_get_virt_method_for_binfo (HOST_W if (!can_refer_decl_in_current_unit_p (fn)) return NULL_TREE; + /* Make sure we create a cgraph node for functions we'll reference. + They can be non-existent if the reference comes from an entry + of an external vtable for example. */ + cgraph_get_create_node (fn); + return fn; } help?
Author: rguenth Date: Wed Mar 14 13:01:46 2012 New Revision: 185381 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185381 Log: 2012-03-14 Richard Guenther <rguenther@suse.de> PR middle-end/52582 * gimple-fold.c (canonicalize_constructor_val): Make sure we have a cgraph node for a FUNCTION_DECL that comes from a constructor. (gimple_get_virt_method_for_binfo): Likewise. Modified: trunk/gcc/ChangeLog trunk/gcc/gimple-fold.c
Author: jakub Date: Wed Mar 14 14:21:12 2012 New Revision: 185383 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185383 Log: PR c++/52582 * config/rs6000/rs6000.c (call_ABI_of_interest): Return true if c_node is NULL. * g++.dg/opt/pr52582.C: New test. Added: branches/gcc-4_7-branch/gcc/testsuite/g++.dg/opt/pr52582.C Modified: branches/gcc-4_7-branch/gcc/ChangeLog branches/gcc-4_7-branch/gcc/config/rs6000/rs6000.c branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
Author: jakub Date: Wed Mar 14 14:24:32 2012 New Revision: 185384 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185384 Log: PR c++/52582 * config/rs6000/rs6000.c (call_ABI_of_interest): Return true if c_node is NULL. * g++.dg/opt/pr52582.C: New test. Added: trunk/gcc/testsuite/g++.dg/opt/pr52582.C Modified: trunk/gcc/testsuite/ChangeLog
Temporarily worked around for 4.7.0. We really should find out why we aren't setting DECL_EXTERNAL on this.
Created attachment 26893 [details] patch Does this fix it?
On this testcase? Yes, it does. Haven't done bootstrap/regtest with it though.
Bootstrapped/regtested now on x86_64-linux and i686-linux (trunk) and {x86_64,i686,powerpc,powerpc64}-linux (4.7 branch, with the rs6000.c change backed out). No regressions. So this looks ok for 4.8/4.7.1 to me, for 4.7.0 I think we should just keep the rs6000 hack. Thanks.
Author: jason Date: Thu Mar 15 21:22:38 2012 New Revision: 185443 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185443 Log: PR c++/52582 * method.c (implicitly_declare_fn): Set DECL_EXTERNAL. Added: trunk/gcc/testsuite/g++.dg/torture/pr52582.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/method.c trunk/gcc/testsuite/ChangeLog
GCC 4.7.0 is being released, adjusting target milestone.
Author: jason Date: Thu Mar 22 18:34:24 2012 New Revision: 185705 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185705 Log: PR c++/52582 * method.c (implicitly_declare_fn): Set DECL_EXTERNAL. Added: branches/gcc-4_7-branch/gcc/testsuite/g++.dg/torture/pr52582.C Modified: branches/gcc-4_7-branch/gcc/cp/ChangeLog branches/gcc-4_7-branch/gcc/cp/method.c branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
Fixed.