| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O3 -fdump-tree-fnsplit" } */ |
| 3 |
class MemoryManager; |
| 4 |
class XMLExcepts { |
| 5 |
public : |
| 6 |
enum Codes { |
| 7 |
AttrList_BadIndex |
| 8 |
}; |
| 9 |
}; |
| 10 |
class XMLException { |
| 11 |
public: |
| 12 |
XMLException(const char* const srcFile, const unsigned int srcLine, |
| 13 |
MemoryManager* const memoryManager = 0); |
| 14 |
}; |
| 15 |
class ArrayIndexOutOfBoundsException : public XMLException { |
| 16 |
public: |
| 17 |
ArrayIndexOutOfBoundsException(const char* const srcFile , const unsigned |
| 18 |
int srcLine , const XMLExcepts::Codes toThrow , MemoryManager* memoryManager = |
| 19 |
0) : XMLException(srcFile, srcLine, memoryManager) { |
| 20 |
} |
| 21 |
}; |
| 22 |
class XMLAttDef { |
| 23 |
bool fExternalAttribute; |
| 24 |
}; |
| 25 |
class XMLAttDefList { |
| 26 |
public: |
| 27 |
MemoryManager* getMemoryManager() const; |
| 28 |
}; |
| 29 |
class DTDAttDef : public XMLAttDef { |
| 30 |
}; |
| 31 |
class DTDAttDefList : public XMLAttDefList { |
| 32 |
virtual const XMLAttDef &getAttDef(unsigned int index) const ; |
| 33 |
DTDAttDef** fArray; |
| 34 |
unsigned int fCount; |
| 35 |
}; |
| 36 |
const XMLAttDef &DTDAttDefList::getAttDef(unsigned int index) const { |
| 37 |
if(index >= fCount) |
| 38 |
throw ArrayIndexOutOfBoundsException("foo.cpp", 0, |
| 39 |
XMLExcepts::AttrList_BadIndex, getMemoryManager()); |
| 40 |
return *(fArray[index]); |
| 41 |
} |
| 42 |
|
| 43 |
/* Mistake in branch prediction caused us to split away real body of the function keeping |
| 44 |
only throw () invokation. This is bad idea. */ |
| 45 |
/* { dg-final { scan-tree-dump-not "Splitting function" "fnsplit"} } */ |