[llvm] r271851 - [BitCode] Make sure atomicrmw's argument is an actual PointerType
Filipe Cabecinhas via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 5 11:43:40 PDT 2016
Author: filcab
Date: Sun Jun 5 13:43:40 2016
New Revision: 271851
URL: http://llvm.org/viewvc/llvm-project?rev=271851&view=rev
Log:
[BitCode] Make sure atomicrmw's argument is an actual PointerType
Added:
llvm/trunk/test/Bitcode/Inputs/invalid-nonpointer-atomicrmw.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=271851&r1=271850&r2=271851&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Sun Jun 5 13:43:40 2016
@@ -5340,6 +5340,7 @@ std::error_code BitcodeReader::parseFunc
unsigned OpNum = 0;
Value *Ptr, *Val;
if (getValueTypePair(Record, OpNum, NextValueNo, Ptr) ||
+ !isa<PointerType>(Ptr->getType()) ||
popValue(Record, OpNum, NextValueNo,
cast<PointerType>(Ptr->getType())->getElementType(), Val) ||
OpNum+4 != Record.size())
Added: llvm/trunk/test/Bitcode/Inputs/invalid-nonpointer-atomicrmw.bc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/Inputs/invalid-nonpointer-atomicrmw.bc?rev=271851&view=auto
==============================================================================
Binary files llvm/trunk/test/Bitcode/Inputs/invalid-nonpointer-atomicrmw.bc (added) and llvm/trunk/test/Bitcode/Inputs/invalid-nonpointer-atomicrmw.bc Sun Jun 5 13:43:40 2016 differ
Modified: llvm/trunk/test/Bitcode/invalid.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/invalid.test?rev=271851&r1=271850&r2=271851&view=diff
==============================================================================
--- llvm/trunk/test/Bitcode/invalid.test (original)
+++ llvm/trunk/test/Bitcode/invalid.test Sun Jun 5 13:43:40 2016
@@ -227,3 +227,8 @@ RUN: not llvm-dis -disable-output %p/Inp
RUN: FileCheck --check-prefix=NONPOINTER-STOREATOMIC %s
NONPOINTER-STOREATOMIC: Invalid record
+
+RUN: not llvm-dis -disable-output %p/Inputs/invalid-nonpointer-atomicrmw.bc 2>&1 | \
+RUN: FileCheck --check-prefix=NONPOINTER-ATOMICRMW %s
+
+NONPOINTER-ATOMICRMW: Invalid record
More information about the llvm-commits
mailing list