From 437ffe7b16428fc85566cc80207b2591ecbbf1e9 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 2 Jun 2010 17:39:43 +0200 Subject: [PATCH] re PR middle-end/44295 (Failed to build 483.xalancbmk in SPEC CPU 2006) PR middle-end/44295 * cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Do not create new cgraph node to check callee. * testsuite/g++.dg/torture/pr44295.C: Neww testcase. From-SVN: r160159 --- gcc/ChangeLog | 6 + gcc/cgraphunit.c | 8 +- gcc/testsuite/ChangeLog | 5 + gcc/testsuite/g++.dg/torture/pr44295.C | 170 +++++++++++++++++++++++++ 4 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/torture/pr44295.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 755c476e9c2..f47194c136d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-06-02 Jan Hubicka + + PR middle-end/44295 + * cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Do not + create new cgraph node to check callee. + 2010-06-02 Richard Guenther * lto-streamer-in.c (input_gimple_stmt): Fix typo. diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 47686a4212a..54752ed54c1 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -2346,13 +2346,19 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e) tree decl = gimple_call_fndecl (e->call_stmt); gimple new_stmt; gimple_stmt_iterator gsi; +#ifdef ENABLE_CHECKING + struct cgraph_node *node; +#endif if (!decl || decl == e->callee->decl /* Don't update call from same body alias to the real function. */ || cgraph_get_node (decl) == cgraph_get_node (e->callee->decl)) return e->call_stmt; - gcc_assert (!cgraph_node (decl)->clone.combined_args_to_skip); +#ifdef ENABLE_CHECKING + node = cgraph_get_node (decl); + gcc_assert (!node || !node->clone.combined_args_to_skip); +#endif if (cgraph_dump_file) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bbaf1c82e57..158b06676ee 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-06-02 Jan Hubicka + + PR middle-end/44295 + * testsuite/g++.dg/torture/pr44295.C: Neww testcase. + 2010-06-02 Jan Hubicka * gcc.dg/tree-ssa/loadpre6.c: Update. diff --git a/gcc/testsuite/g++.dg/torture/pr44295.C b/gcc/testsuite/g++.dg/torture/pr44295.C new file mode 100644 index 00000000000..004b7c00b42 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr44295.C @@ -0,0 +1,170 @@ +/* { dg-do compile } */ +extern "C" { + typedef long unsigned int size_t; + typedef struct { + } __sigset_t; + typedef union { + } pthread_barrierattr_t; + } + typedef unsigned short XMLCh; + typedef unsigned long XMLSize_t; + namespace xercesc_2_5 { + class DOMNodeList; + class DOMNode { + }; + class DOMDocumentRange { + }; + class DOMDocument: public DOMDocumentRange, public DOMNode { + }; + union wait { + struct { + } + __wait_stopped; + } + div_t; + class MemoryManager; + class XMemory { + public : void* operator new(size_t size, MemoryManager* memMgr); + void operator delete(void* p); + void operator delete(void* p, MemoryManager* memMgr); + }; + class XMLExcepts { + public : enum Codes { + NoError = 0 , HshTbl_ZeroModulus = 48 , HshTbl_BadHashFromKey = 49 }; + }; + class XMLUni { + }; + } + namespace xercesc_2_5 { + class XMLException : public XMemory { + public: + virtual ~XMLException(); + XMLException(const char* const srcFile, const unsigned int srcLine, MemoryManager* const memoryManager = 0); + void loadExceptText ( const XMLExcepts::Codes toLoad ); + }; + class XMLDeleter { + }; + class XMLPlatformUtils { + public : static MemoryManager* fgMemoryManager; + static inline size_t alignPointerForNewBlockAllocation(size_t ptrSize); + }; + inline size_t XMLPlatformUtils::alignPointerForNewBlockAllocation(size_t ptrSize) { + } + class HashBase : public XMemory { + public: + virtual bool equals(const void *const key1, const void *const key2) = 0; + virtual ~HashBase() { +}; + }; + class IllegalArgumentException : public XMLException { + public: +IllegalArgumentException(const char* const srcFile , const unsigned int srcLine , const XMLExcepts::Codes toThrow , MemoryManager* memoryManager = 0) : XMLException(srcFile, srcLine, memoryManager) { + loadExceptText(toThrow); + } + }; + class RuntimeException : public XMLException { + public: +RuntimeException(const char* const srcFile , const unsigned int srcLine , const XMLExcepts::Codes toThrow , MemoryManager* memoryManager = 0) : XMLException(srcFile, srcLine, memoryManager) { + loadExceptText(toThrow); + } + }; + class MemoryManager { + public: + virtual ~MemoryManager() { + } + virtual void* allocate(size_t size) = 0; + }; + template class BaseRefVectorOf : public XMemory { + BaseRefVectorOf ( const unsigned int maxElems , const bool adoptElems = true , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); + virtual ~BaseRefVectorOf(); + bool fAdoptedElems; + TElem** fElemList; + }; + template BaseRefVectorOf::BaseRefVectorOf( const unsigned int maxElems , const bool adoptElems , MemoryManager* const manager) : fAdoptedElems(adoptElems) { + for (unsigned int index = 0; + index < maxElems; + index++) fElemList[index] = 0; + } + template BaseRefVectorOf::~BaseRefVectorOf() { + } + class XMLString { + public: + static bool equals ( const XMLCh* const str1 , const XMLCh* const str2 ); + static void moveChars ( XMLCh* const targetStr , const XMLCh* const srcStr , const unsigned int count ); + }; + inline void XMLString::moveChars( XMLCh* const targetStr , const XMLCh* const srcStr , const unsigned int count) { + } + inline bool XMLString::equals( const XMLCh* const str1 , const XMLCh* const str2) { + const XMLCh* psz1 = str1; + const XMLCh* psz2 = str2; + if (psz1 == 0 || psz2 == 0) { + return true; + } + } + } + namespace xercesc_2_5 { + class HashPtr : public HashBase { + virtual bool equals(const void *const key1, const void *const key2); + }; + template struct DOMDeepNodeListPoolTableBucketElem : public XMemory { + void* fKey1; + XMLCh* fKey2; + XMLCh* fKey3; + }; + template class DOMDeepNodeListPool { + public: + DOMDeepNodeListPool ( const XMLSize_t modulus , const bool adoptElems , const XMLSize_t initSize = 128 ); + TVal* getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3); + DOMDeepNodeListPoolTableBucketElem* findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal); + bool fAdoptedElems; + DOMDeepNodeListPoolTableBucketElem** fBucketList; + XMLSize_t fHashModulus; + HashBase* fHash; + TVal** fIdPtrs; + XMLSize_t fIdPtrsCount; + MemoryManager* fMemoryManager; + }; + template DOMDeepNodeListPool::DOMDeepNodeListPool( const XMLSize_t modulus , const bool adoptElems , const XMLSize_t initSize) : fAdoptedElems(adoptElems) , fBucketList(0) , fHash(0) , fIdPtrs(0) { + fHash = new (fMemoryManager) HashPtr(); + fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*)); + if (modulus == 0) throw IllegalArgumentException("./xercesc/dom/impl/bad.c", 38, XMLExcepts::HshTbl_ZeroModulus, fMemoryManager); + } + template TVal* DOMDeepNodeListPool::getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3) { + XMLSize_t hashVal; + DOMDeepNodeListPoolTableBucketElem* findIt = findBucketElem(key1, key2, key3, hashVal); + } + template DOMDeepNodeListPoolTableBucketElem* DOMDeepNodeListPool:: findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal) { + if (hashVal > fHashModulus) throw RuntimeException("./xercesc/dom/impl/bad.c", 64, XMLExcepts::HshTbl_BadHashFromKey, fMemoryManager); + DOMDeepNodeListPoolTableBucketElem* curElem = fBucketList[hashVal]; + if (fHash->equals(key1, curElem->fKey1) && (XMLString::equals(key2, curElem->fKey2)) && (XMLString::equals(key3, curElem->fKey3))) { + return curElem; + } + } + class DOMDeepNodeListImpl; + class DOMDocumentImpl: public DOMDocument { + DOMNodeList* getElementsByTagName(const XMLCh * tagname) const; + DOMNodeList* getDeepNodeList(const DOMNode *rootNode, const XMLCh *tagName); + DOMNodeList* getDeepNodeList(const DOMNode *rootNode, const XMLCh *namespaceURI, const XMLCh *localName); + DOMDeepNodeListPool* fNodeListPool; + }; + } + void * operator new(size_t amt, xercesc_2_5:: DOMDocument *doc); + namespace xercesc_2_5 { + class DOMNodeList { + }; + class DOMDeepNodeListImpl: public DOMNodeList { + }; + DOMNodeList *DOMDocumentImpl::getElementsByTagName(const XMLCh *tagname) const { + return ((DOMDocumentImpl*)this)->getDeepNodeList(this,tagname); + } + DOMNodeList *DOMDocumentImpl::getDeepNodeList(const DOMNode *rootNode, const XMLCh *tagName) { + if(!fNodeListPool) { + fNodeListPool = new (this) DOMDeepNodeListPool(109, false); + } + DOMNodeList* retList = fNodeListPool->getByKey(rootNode, tagName, 0); + } + DOMNodeList *DOMDocumentImpl::getDeepNodeList(const DOMNode *rootNode, const XMLCh *namespaceURI, const XMLCh *localName) { + DOMNodeList* retList = fNodeListPool->getByKey(rootNode, localName, namespaceURI); + } + } + -- 2.30.2