mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 16:19:52 +00:00
IR: Properly return nullptr when getAggregateElement is out-of-bounds
We didn't properly handle the out-of-bounds case for ConstantAggregateZero and UndefValue. This would manifest as a crash when the constant folder was asked to fold a load of a constant global whose struct type has no operands. This fixes PR22595. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229352 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -325,6 +325,9 @@ public:
|
||||
/// index.
|
||||
Constant *getElementValue(unsigned Idx) const;
|
||||
|
||||
/// \brief Return the number of elements in the array, vector, or struct.
|
||||
unsigned getNumElements() const;
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
///
|
||||
static bool classof(const Value *V) {
|
||||
@@ -1196,6 +1199,9 @@ public:
|
||||
/// index.
|
||||
UndefValue *getElementValue(unsigned Idx) const;
|
||||
|
||||
/// \brief Return the number of elements in the array, vector, or struct.
|
||||
unsigned getNumElements() const;
|
||||
|
||||
void destroyConstant() override;
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
|
||||
Reference in New Issue
Block a user