[llvm] r271850 - [BitCode] Make sure storeatomic's argument is an actual PointerType

Filipe Cabecinhas via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 5 11:43:33 PDT 2016


Author: filcab
Date: Sun Jun  5 13:43:33 2016
New Revision: 271850

URL: http://llvm.org/viewvc/llvm-project?rev=271850&view=rev
Log:
[BitCode] Make sure storeatomic's argument is an actual PointerType

Added:
    llvm/trunk/test/Bitcode/Inputs/invalid-nonpointer-storeatomic.bc
Modified:
    llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
    llvm/trunk/test/Bitcode/invalid.test

Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=271850&r1=271849&r2=271850&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Sun Jun  5 13:43:33 2016
@@ -5259,6 +5259,7 @@ std::error_code BitcodeReader::parseFunc
       unsigned OpNum = 0;
       Value *Val, *Ptr;
       if (getValueTypePair(Record, OpNum, NextValueNo, Ptr) ||
+          !isa<PointerType>(Ptr->getType()) ||
           (BitCode == bitc::FUNC_CODE_INST_STOREATOMIC
                ? getValueTypePair(Record, OpNum, NextValueNo, Val)
                : popValue(Record, OpNum, NextValueNo,

Added: llvm/trunk/test/Bitcode/Inputs/invalid-nonpointer-storeatomic.bc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/Inputs/invalid-nonpointer-storeatomic.bc?rev=271850&view=auto
==============================================================================
Binary files llvm/trunk/test/Bitcode/Inputs/invalid-nonpointer-storeatomic.bc (added) and llvm/trunk/test/Bitcode/Inputs/invalid-nonpointer-storeatomic.bc Sun Jun  5 13:43:33 2016 differ

Modified: llvm/trunk/test/Bitcode/invalid.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/invalid.test?rev=271850&r1=271849&r2=271850&view=diff
==============================================================================
--- llvm/trunk/test/Bitcode/invalid.test (original)
+++ llvm/trunk/test/Bitcode/invalid.test Sun Jun  5 13:43:33 2016
@@ -222,3 +222,8 @@ RUN: not llvm-dis -disable-output %p/Inp
 RUN:   FileCheck --check-prefix=GEP-NO-OPERANDS %s
 
 GEP-NO-OPERANDS: Invalid gep with no operands
+
+RUN: not llvm-dis -disable-output %p/Inputs/invalid-nonpointer-storeatomic.bc 2>&1 | \
+RUN:   FileCheck --check-prefix=NONPOINTER-STOREATOMIC %s
+
+NONPOINTER-STOREATOMIC: Invalid record




More information about the llvm-commits mailing list