mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
[BitCode] Diagnose GEPs with no indices
llvm-svn: 271849
This commit is contained in:
parent
cb52965257
commit
06c97ab46d
@ -3090,6 +3090,9 @@ std::error_code BitcodeReader::parseConstants() {
|
||||
return error("Explicit gep operator type does not match pointee type "
|
||||
"of pointer operand");
|
||||
|
||||
if (Elts.size() < 1)
|
||||
return error("Invalid gep with no operands");
|
||||
|
||||
ArrayRef<Constant *> Indices(Elts.begin() + 1, Elts.end());
|
||||
V = ConstantExpr::getGetElementPtr(PointeeType, Elts[0], Indices,
|
||||
BitCode ==
|
||||
|
BIN
test/Bitcode/Inputs/invalid-gep-no-operands.bc
Normal file
BIN
test/Bitcode/Inputs/invalid-gep-no-operands.bc
Normal file
Binary file not shown.
@ -217,3 +217,8 @@ RUN: not llvm-dis -disable-output %p/Inputs/invalid-void-constant.bc 2>&1 | \
|
||||
RUN: FileCheck --check-prefix=VOID-CONSTANT-TYPE %s
|
||||
|
||||
VOID-CONSTANT-TYPE: Invalid constant type
|
||||
|
||||
RUN: not llvm-dis -disable-output %p/Inputs/invalid-gep-no-operands.bc 2>&1 | \
|
||||
RUN: FileCheck --check-prefix=GEP-NO-OPERANDS %s
|
||||
|
||||
GEP-NO-OPERANDS: Invalid gep with no operands
|
||||
|
Loading…
Reference in New Issue
Block a user