found compiling opensp: $ g++ -O2 Big5CodingSystem.ii Big5CodingSystem.cxx:65:1: internal compiler error: in ipcp_iterate_stage, at ipa-cp.c:766 $ gcc -v Using built-in specs. COLLECT_GCC=/usr/x86_64-unknown-linux-gnu/gcc-bin/4.5.0-pre9999/gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0-pre9999/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-4.5.0_pre9999/work/gcc-4.5.0-9999/configure --prefix=/usr --bindir=/usr/x86_64-unknown-linux-gnu/gcc-bin/4.5.0-pre9999 --includedir=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.0-pre9999/include --datadir=/usr/share/gcc-data/x86_64-unknown-linux-gnu/4.5.0-pre9999 --mandir=/usr/share/gcc-data/x86_64-unknown-linux-gnu/4.5.0-pre9999/man --infodir=/usr/share/gcc-data/x86_64-unknown-linux-gnu/4.5.0-pre9999/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.0-pre9999/include/g++-v4 --host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu --disable-altivec --disable-fixed-point --with-ppl --with-cloog --disable-nls --with-system-zlib --disable-checking --disable-werror --enable-secureplt --enable-multilib --disable-libmudflap --disable-libssp --enable-libgomp --enable-cld --with-python-dir=/share/gcc-data/x86_64-unknown-linux-gnu/4.5.0-pre9999/python --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo SVN' --enable-lto --enable-checking Thread model: posix gcc version 4.5.0-pre9999 20091215 (experimental) rev. 155245 (Gentoo SVN)
Created attachment 19314 [details] Big5CodingSystem.ii
Confirmed. # 1 "CodingSystem.h" 1 #pragma interface # 1 "types.h" 1 # 15 "CodingSystem.h" 1 class Decoder { unsigned minBytesPerChar() const; }; class Encoder { class Handler { }; }; class InputCodingSystem { virtual bool isIdentity() const; }; class OutputCodingSystem { public: virtual ~OutputCodingSystem(); virtual Encoder *makeEncoder() const = 0; }; class CodingSystem : public InputCodingSystem, public OutputCodingSystem { public: ~CodingSystem() {} }; # 8 "Big5CodingSystem.h" 1 class Big5CodingSystem : public CodingSystem { Decoder *makeDecoder() const; Encoder *makeEncoder() const; }; Encoder *Big5CodingSystem::makeEncoder() const { }
It is caused by revision 155143: http://gcc.gnu.org/ml/gcc-cvs/2009-12/msg00287.html
Both the base and deleting dtor in this case are !DECL_COMDAT, DECL_COMDAT_GROUP != NULL, DECL_EXTERNAL. But they are emitted anyway, despite the DECL_EXTERNAL, as the base dtor is needed.
Actually they aren't emitted, they are really just external. And they are supposed to be external. I guess we shouldn't "optimize" known external ctors or dtors. The question then is whether for the DECL_DEFER_OUTPUT ones we sometimes don't keep node->same_comdat_group and/or node->same_body even when we decide at the end that they will be really external.
Created attachment 19322 [details] gcc45-pr42386.patch Fix for this testcase. If we already at maybe_clone_body time know that the ctor or dtor will not be emitted in the current TU, we shouldn't create any same_body/same_comdat_group relations between the symbols. The question is if for DECL_DEFER_OUTPUT we might decide later on that it is really DECL_EXTERNAL (i.e. not clear DECL_EXTERNAL on it). Alternatively same_comdat_group could be only considered for !DECL_EXTERNAL decls.
(In reply to comment #6) > Created an attachment (id=19322) [edit] > gcc45-pr42386.patch > > Fix for this testcase. If we already at maybe_clone_body time know that > the ctor or dtor will not be emitted in the current TU, we shouldn't create any > same_body/same_comdat_group relations between the symbols. > The question is if for DECL_DEFER_OUTPUT we might decide later on that it is > really DECL_EXTERNAL (i.e. not clear DECL_EXTERNAL on it). > Alternatively same_comdat_group could be only considered for !DECL_EXTERNAL > decls. > Do we need those # 1 "types.h" 1 # 15 "CodingSystem.h" 1 in testcase?
Created attachment 19323 [details] gcc45-pr42386.patch Another alternative - don't mark nodes as reachable because of same_comdat_group links if they are DECL_EXTERNAL. Fixes this too, and has the advantage that we don't have issues with DECL_DEFER_OUTPUT dtors we decided to keep DECL_EXTERNAL.
Re: #c7, those 2 lines aren't needed, the other two # lines are needed as is #pragma interface.
The second patch seems better.
Subject: Bug 42386 Author: jakub Date: Thu Dec 17 19:29:48 2009 New Revision: 155321 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155321 Log: PR c++/42386 * ipa.c (function_and_variable_visibility): Clear same_comdat_group links of DECL_EXTERNAL nodes. * g++.dg/opt/dtor3.C: New test. Added: trunk/gcc/testsuite/g++.dg/opt/dtor3.C Modified: trunk/gcc/ChangeLog trunk/gcc/ipa.c trunk/gcc/testsuite/ChangeLog
Fixed.
Subject: Bug 42386 Author: hjl Date: Tue Dec 22 18:17:53 2009 New Revision: 155403 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155403 Log: Backport testcases from mainline. 2009-12-22 H.J. Lu <hongjiu.lu@intel.com> Backport from mainline: 2009-12-19 Dodji Seketeli <dodji@redhat.com> PR c++/42225 * g++.dg/template/typedef26.C: New test. 2009-12-17 Jakub Jelinek <jakub@redhat.com> PR c++/42386 * g++.dg/opt/dtor3.C: New test. 2009-12-15 Jason Merrill <jason@redhat.com> PR c++/42358 * g++.dg/cpp0x/variadic98.C: New. 2009-12-13 Richard Guenther <rguenther@suse.de> PR tree-optimization/42357 * g++.dg/torture/pr42357.C: New testcase. Added: branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/variadic98.C - copied unchanged from r155402, trunk/gcc/testsuite/g++.dg/cpp0x/variadic98.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/opt/dtor3.C - copied unchanged from r155402, trunk/gcc/testsuite/g++.dg/opt/dtor3.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/typedef26.C - copied unchanged from r155402, trunk/gcc/testsuite/g++.dg/template/typedef26.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42357.C - copied unchanged from r155402, trunk/gcc/testsuite/g++.dg/torture/pr42357.C Modified: branches/gcc-4_4-branch/gcc/testsuite/ChangeLog