Target: x86_64-unknown-linux-gnu Configured with: ../gcc-4.0.2/configure --prefix=/root/bin/ --disable-multilib --enable-languages=c,c++ Thread model: posix gcc version 4.0.2 Output of compile: x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I../generic -mtune=opteron -march=opteron -O2 -fomit-frame-pointer -ftracer -pipe -fweb -ftree-vectorize -finline-functions -c ArcEngine.cxx -MT ArcEngine.lo -MD -MP -MF .deps/ArcEngine.TPlo -fPIC -DPIC -o .libs/ArcEngine.lo ../include/Attribute.h:356: warning: inline function 'OpenSP::AttributeDefinitionList::~AttributeDefinitionList()' used but never defined ../include/Notation.h:27: warning: inline function 'virtual OpenSP::Notation::~Notation()' used but never defined ../include/Dtd.h:30: warning: inline function 'OpenSP::Dtd::~Dtd()' used but never defined ../include/Lpd.h:149: warning: inline function 'virtual OpenSP::ComplexLpd::~ComplexLpd()' used but never defined ../include/Lpd.h:98: warning: inline function 'virtual OpenSP::LinkSet::~LinkSet()' used but never defined ../include/Sd.h:28: warning: inline function 'OpenSP::Sd::~Sd()' used but never defined ../include/CharsetInfo.h:22: warning: inline function 'OpenSP::CharsetInfo::~CharsetInfo()' used but never defined ../include/UnivCharsetDesc.h:22: warning: inline function 'OpenSP::UnivCharsetDesc::~UnivCharsetDesc()' used but never defined ../include/CharsetDecl.h:71: warning: inline function 'OpenSP::CharsetDecl::~CharsetDecl()' used but never defined ../include/Syntax.h:28: warning: inline function 'OpenSP::Syntax::~Syntax()' used but never defined ../include/Entity.h:272: warning: inline function 'virtual OpenSP::EntityOrigin::~EntityOrigin()' used but never defined ../include/Location.h:130: warning: inline function 'OpenSP::InputSourceOrigin::~InputSourceOrigin()' used but never defined ../include/Markup.h:41: warning: inline function 'OpenSP::Markup::~Markup()' used but never defined ../include/ElementType.h:30: warning: inline function 'OpenSP::ElementDefinition::~ElementDefinition()' used but never defined ../include/Ptr.cxx:23: warning: inline function 'virtual OpenSP::InputSourceOrigin::~InputSourceOrigin()' used but never defined ../include/Text.h:21: warning: inline function 'OpenSP::TextItem& OpenSP::TextItem::operator=(const OpenSP::TextItem&)' used but never defined ../include/ContentToken.h:22: warning: inline function 'OpenSP::Transition::~Transition()' used but never defined Recognizer.h:24: warning: inline function 'OpenSP::Recognizer::~Recognizer()' used but never defined ../include/Message.h:132: warning: inline function 'OpenSP::OpenElementInfo::~OpenElementInfo()' used but never defined ../include/ContentToken.h:309: warning: inline function 'OpenSP::CompiledModelGroup::~CompiledModelGroup()' used but never defined ../include/Attribute.h:460: warning: inline function 'OpenSP::Attribute::~Attribute()' used but never defined ../include/Text.h:21: warning: inline function 'OpenSP::TextItem::TextItem(const OpenSP::TextItem&)' used but never defined ../include/Text.h:21: warning: inline function 'OpenSP::TextItem::~TextItem()' used but never defined ../include/Lpd.h:27: warning: inline function 'OpenSP::ResultElementSpec::~ResultElementSpec()' used but never defined ../include/CharsetDecl.h:49: warning: inline function 'OpenSP::CharsetDeclSection::~CharsetDeclSection()' used but never defined ../include/ContentToken.h:117: warning: inline function 'virtual OpenSP::ModelGroup::~ModelGroup()' used but never defined ../include/ContentToken.h:196: warning: inline function 'virtual OpenSP::LeafContentToken::~LeafContentToken()' used but never defined ../include/ContentToken.h:182: warning: inline function 'OpenSP::AndInfo::~AndInfo()' used but never defined ../include/CharsetDecl.h:20: warning: inline function 'OpenSP::CharsetDeclRange::~CharsetDeclRange()' used but never defined ../include/Lpd.h:93: warning: inline function 'OpenSP::SourceLinkRuleResource::~SourceLinkRuleResource()' used but never defined ../include/Lpd.h:71: warning: inline function 'OpenSP::SourceLinkRule::~SourceLinkRule()' used but never defined x86_64-pc-linux-gnu-g++: Internal error: Segmentation fault (program cc1plus) Please submit a full bug report. See <URL:http://bugs.gentoo.org/> for instructions. {standard input}: Assembler messages: {standard input}:1275: Warning: end of file not at end of a line; newline inserted The ICE only happens with -O2 -finline-functions (or anything including those)
Created attachment 9914 [details] Preprocessed source that causes ICE
../include/InternalInputSource.h:37: error: extra qualification ‘OpenSP::InternalInputSource::’ on member ‘asInternalInputSource’ ignored
After fixing that error, the mainline does not segfault, the 4.0 branch still does. Reducing.
I am starting to think this is a front-end bug. Removing all lines begining with ^# "fixes" the ICE.
This looks like another "pragma interface" bug.
I am starting to think this is a dup of bug 22252 because of the diagnostic we get.
Adding those patches into gcc-4.0.2 seems to resolve the problem.
Confirmed, reduced testcase: typedef __SIZE_TYPE__ size_t; struct Allocator { }; template<class T> struct Ptr { ~Ptr(); T *ptr_; }; template<class T> struct ConstPtr : private Ptr<T> { ConstPtr(const Ptr<T> &p); }; template<class T> Ptr<T>::~Ptr() { delete ptr_; } #pragma interface struct AttributeDefinitionList { ConstPtr<AttributeDefinitionList> prev_; }; struct Dtd { Ptr<AttributeDefinitionList> implicitElementAttributeDef_; }; struct EndElementEvent { void *operator new(size_t sz, Allocator &alloc); EndElementEvent(const ConstPtr<Dtd> &); }; struct ArcProcessor { void processEndElement(Allocator &); Ptr<Dtd> metaDtd_; }; void ArcProcessor::processEndElement(Allocator &alloc) { new (alloc) EndElementEvent( metaDtd_); }
Shorter testcase (ICEs with -O): =============================================================== #pragma interface template<typename T> struct A { T *p; ~A() { delete p; } }; template<typename T> struct B : A<T> { B(const A<T>&); }; struct C { B<C> b; C(const B<C>&); }; void foo() { new C(A<C>()); } ===============================================================
*** This bug has been marked as a duplicate of 22252 ***