https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92600

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |8.3.0
   Target Milestone|---                         |9.3
            Summary|ICE: symtab_node::verify    |[9/10 Regression] ICE:
                   |failed, building            |symtab_node::verify failed,
                   |523.xalancbmk_r with -flto  |building 523.xalancbmk_r
                   |-fno-inline                 |with -flto -fno-inline
                   |                            |since r267359
      Known to fail|                            |10.0, 9.2.0

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #3)
> It's related to PR92599. It's also an ODR violation that leads to the ICE.

So it must be something different. There are source files which do not violate
ODR:

$ cat 1.ii
unsigned short a;
namespace xercesc_2_7 {
class MemoryManager;
class XMemory {};
class XMLErrorReporter {
  virtual void resetErrors();
};
class XMLBuffer {};
class XMLBufferMgr {
  unsigned fBufCount;
  MemoryManager *fMemoryManager;
  XMLBuffer **fBufList;
};
template <class> class RefVectorOf;
class XMLStringPool;
class GrammarResolver;
class XMLValidator;
template <class> class ValueStackOf;
class XMLEntityHandler;
class ErrorHandler;
class XMLScanner {
public:
  XMLEntityHandler *fEntityHandler;
};
class SGXMLScanner : XMLScanner {
  int *resolveSystemId();
};
class XMLDocumentHandler {
  virtual void endEntityReference();
};
class XMLEntityHandler {
public:
  virtual bool expandSystemId(const unsigned short *, XMLBuffer &);
};
class PSVIHandler {
  virtual void handleElementPSVI();
};
class DOMNode;
class DOMEntity;
class DocTypeHandler {
  virtual void startIntSubset();
};
class DOMDocumentImpl;
class DOMDocumentTypeImpl;
class XMLGrammarPool;
class AbstractDOMParser : XMemory,
                          XMLDocumentHandler,
                          XMLErrorReporter,
                          XMLEntityHandler,
                          DocTypeHandler,
                          PSVIHandler {
  bool fCreateEntityReferenceNodes;
  bool fIncludeIgnorableWhitespace;
  bool fWithinElement;
  bool fParseInProgress;
  bool fCreateCommentNodes;
  bool fDocumentAdoptedByUser;
  bool fCreateSchemaInfo;
  XMLScanner *fScanner;
  unsigned short *fImplementationFeatures;
  DOMNode *fCurrentParent;
  DOMNode *fCurrentNode;
  DOMEntity *fCurrentEntity;
  DOMDocumentImpl *fDocument;
  ValueStackOf<DOMNode *> *fNodeStack;
  DOMDocumentTypeImpl *fDocumentType;
  RefVectorOf<DOMDocumentImpl> *fDocumentVector;
  GrammarResolver *fGrammarResolver;
  XMLStringPool *fURIStringPool;
  XMLValidator *fValidator;
  MemoryManager *fMemoryManager;
  XMLGrammarPool *fGrammarPool;
  XMLBufferMgr fBufMgr;
  XMLBuffer &fInternalSubset;
  PSVIHandler *fPSVIHandler;
};
class EntityResolver;
class XMLEntityResolver;
class XercesDOMParser : AbstractDOMParser {
  virtual void error();
  bool expandSystemId(const unsigned short *, XMLBuffer &);
  EntityResolver *fEntityResolver;
  XMLEntityResolver *fXMLEntityResolver;
  ErrorHandler *fErrorHandler;
};
inline bool XercesDOMParser::expandSystemId(const unsigned short *,
                                            XMLBuffer &) { return false; }
int *SGXMLScanner::resolveSystemId() {
  XMLBuffer b;
  fEntityHandler->expandSystemId(&a, b);
  return 0;
}
} // namespace xercesc_2_7

$ cat 2.ii
namespace xercesc_2_7 {
class DOMNode;
class DOMEntity;
class MemoryManager;
class XMemory {};
class XMLErrorReporter {
public:
  virtual ~XMLErrorReporter();
};
template <class> class RefVectorOf;
class XMLDocumentHandler {
  virtual void XMLDecl();
};
class XMLBuffer;
class XMLEntityHandler {
  virtual bool expandSystemId(const unsigned short *, XMLBuffer &);
};
template <class> class ValueStackOf;
class GrammarResolver;
class XMLStringPool;
class DocTypeHandler {
public:
  virtual ~DocTypeHandler();
};
class XMLBufferMgr {
  unsigned fBufCount;
  MemoryManager *fMemoryManager;
  XMLBuffer **fBufList;
};
class PSVIHandler {
  virtual void handlePartialElementPSVI();
};
class XMLScanner;
class XMLValidator;
class DOMDocumentImpl;
class DOMDocumentTypeImpl;
class XMLGrammarPool;
class AbstractDOMParser : XMemory,
                          XMLDocumentHandler,
                          XMLErrorReporter,
                          XMLEntityHandler,
                          DocTypeHandler,
                          PSVIHandler {
  bool fCreateEntityReferenceNodes;
  bool fIncludeIgnorableWhitespace;
  bool fWithinElement;
  bool fParseInProgress;
  bool fCreateCommentNodes;
  bool fDocumentAdoptedByUser;
  bool fCreateSchemaInfo;
  XMLScanner *fScanner;
  unsigned short *fImplementationFeatures;
  DOMNode *fCurrentParent;
  DOMNode *fCurrentNode;
  DOMEntity *fCurrentEntity;
  DOMDocumentImpl *fDocument;
  ValueStackOf<DOMNode *> *fNodeStack;
  DOMDocumentTypeImpl *fDocumentType;
  RefVectorOf<DOMDocumentImpl> *fDocumentVector;
  GrammarResolver *fGrammarResolver;
  XMLStringPool *fURIStringPool;
  XMLValidator *fValidator;
  MemoryManager *fMemoryManager;
  XMLGrammarPool *fGrammarPool;
  XMLBufferMgr fBufMgr;
  XMLBuffer &fInternalSubset;
  PSVIHandler *fPSVIHandler;
};
class EntityResolver;
class ErrorHandler;
class XMLEntityResolver;
class XercesDOMParser : AbstractDOMParser {
  bool expandSystemId(const unsigned short *, XMLBuffer &);
  EntityResolver *fEntityResolver;
  XMLEntityResolver *fXMLEntityResolver;
  ErrorHandler *fErrorHandler;
};
inline bool XercesDOMParser::expandSystemId(const unsigned short *,
                                            XMLBuffer &) { return false; }
} // namespace xercesc_2_7

$ g++-9 -O2 -flto -fno-inline -shared -fPIC 1.ii 2.ii -fchecking
lto1: error: Two symbols with same comdat_group are not linked by the
same_comdat_group list.
_ZN11xercesc_2_715XercesDOMParser14expandSystemIdEPKtRNS_9XMLBufferE/7
(expandSystemId) @0x7f9cfcb50b40
  Type: function definition analyzed
  Visibility: externally_visible undef public weak comdat
comdat_group:_ZN11xercesc_2_715XercesDOMParser14expandSystemIdEPKtRNS_9XMLBufferE
one_only
section:.text._ZN11xercesc_2_715XercesDOMParser14expandSystemIdEPKtRNS_9XMLBufferE
(implicit_section) virtual
  Address is taken.
  References: 
  Referring: *.LTHUNK0/2 (alias)_ZTVN11xercesc_2_715XercesDOMParserE/10 (addr)
  Read from file: /tmp/cchvQQd7.o
  Function flags: count:1073741824 (estimated locally)
  Called by: 
  Calls: 
_ZThn16_N11xercesc_2_715XercesDOMParser14expandSystemIdEPKtRNS_9XMLBufferE/3
(_ZThn16_N11xercesc_2_715XercesDOMParser14expandSystemIdEPKtRNS_9XMLBufferE)
@0x7f9cfcb50870
  Type: function definition analyzed
  Visibility: externally_visible prevailing_def_ironly_exp public weak comdat
comdat_group:_ZN11xercesc_2_715XercesDOMParser14expandSystemIdEPKtRNS_9XMLBufferE
one_only
section:.text._ZN11xercesc_2_715XercesDOMParser14expandSystemIdEPKtRNS_9XMLBufferE
(implicit_section) virtual artificial
  Same comdat group as: *.LTHUNK0/2
  Address is taken.
  References: 
  Referring: _ZTVN11xercesc_2_715XercesDOMParserE/10 (addr)
  Read from file: /tmp/cceOf484.o
  Function flags: calls_comdat_local merged_comdat
  Thunk fixed offset -16 virtual value 0 indirect_offset 0 has virtual offset 0
  Called by: 
  Calls: *.LTHUNK0/2 
(null):0: confused by earlier errors, bailing out
lto-wrapper: fatal error: g++-9 returned 1 exit status
compilation terminated.
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: error:
lto-wrapper failed
collect2: error: ld returned 1 exit status

Started with r267359.

Reply via email to