diff options
author | Igor Laevsky <igmyrj@gmail.com> | 2017-12-13 11:47:35 +0000 |
---|---|---|
committer | Igor Laevsky <igmyrj@gmail.com> | 2017-12-13 11:47:35 +0000 |
commit | f39a29265c29aa71ea9b0ca012a3c9817548b78f (patch) | |
tree | a3d2393051a634151bbca9fd66932afb68ae6cb6 /llvm/unittests/FuzzMutate/OperationsTest.cpp | |
parent | 541f9707a51f9b4046928739130cb4853e8e09f4 (diff) | |
download | bcm5719-llvm-f39a29265c29aa71ea9b0ca012a3c9817548b78f.tar.gz bcm5719-llvm-f39a29265c29aa71ea9b0ca012a3c9817548b78f.zip |
[FuzzMutate] Avoid zero sized aggregates
Differential Revision: https://reviews.llvm.org/D41110
llvm-svn: 320572
Diffstat (limited to 'llvm/unittests/FuzzMutate/OperationsTest.cpp')
-rw-r--r-- | llvm/unittests/FuzzMutate/OperationsTest.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/unittests/FuzzMutate/OperationsTest.cpp b/llvm/unittests/FuzzMutate/OperationsTest.cpp index be1789e9475..0fc6b2c2aeb 100644 --- a/llvm/unittests/FuzzMutate/OperationsTest.cpp +++ b/llvm/unittests/FuzzMutate/OperationsTest.cpp @@ -336,6 +336,7 @@ TEST(OperationsTest, ExtractAndInsertValue) { Type *StructTy = StructType::create(Ctx, {Int8PtrTy, Int32Ty}); Type *OpaqueTy = StructType::create(Ctx, "OpaqueStruct"); + Type *ZeroSizedArrayTy = ArrayType::get(Int64Ty, 0); Type *ArrayTy = ArrayType::get(Int64Ty, 4); Type *VectorTy = VectorType::get(Int32Ty, 2); @@ -346,17 +347,22 @@ TEST(OperationsTest, ExtractAndInsertValue) { Constant *SVal = UndefValue::get(StructTy); Constant *OVal = UndefValue::get(OpaqueTy); Constant *AVal = UndefValue::get(ArrayTy); + Constant *ZAVal = UndefValue::get(ZeroSizedArrayTy); Constant *VVal = UndefValue::get(VectorTy); EXPECT_TRUE(EVOp.SourcePreds[0].matches({}, SVal)); - EXPECT_TRUE(EVOp.SourcePreds[0].matches({}, OVal)); + EXPECT_FALSE(EVOp.SourcePreds[0].matches({}, OVal)); EXPECT_TRUE(EVOp.SourcePreds[0].matches({}, AVal)); EXPECT_FALSE(EVOp.SourcePreds[0].matches({}, VVal)); EXPECT_TRUE(IVOp.SourcePreds[0].matches({}, SVal)); - EXPECT_TRUE(IVOp.SourcePreds[0].matches({}, OVal)); + EXPECT_FALSE(IVOp.SourcePreds[0].matches({}, OVal)); EXPECT_TRUE(IVOp.SourcePreds[0].matches({}, AVal)); EXPECT_FALSE(IVOp.SourcePreds[0].matches({}, VVal)); + // Don't consider zero sized arrays as viable sources + EXPECT_FALSE(EVOp.SourcePreds[0].matches({}, ZAVal)); + EXPECT_FALSE(IVOp.SourcePreds[0].matches({}, ZAVal)); + // Make sure we're range checking appropriately. EXPECT_TRUE( EVOp.SourcePreds[1].matches({SVal}, ConstantInt::get(Int32Ty, 0))); |