Commit 22ed4eb4 by Karl Schimpf

Fix subzero translator to use new API for reporting errors.

The error handling in LLVM for errors has been updated so that errors in the bitcode stream no longer cause (assertion crashes). This CL applies the appropriate changes to subzero. See CL https://codereview.chromium.org/932953002 for changes to error handling for LLVM. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4002 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/916313004
parent d9dc82e4
...@@ -162,9 +162,9 @@ class TopLevelParser : public NaClBitcodeParser { ...@@ -162,9 +162,9 @@ class TopLevelParser : public NaClBitcodeParser {
public: public:
typedef std::vector<Ice::FunctionDeclaration *> FunctionDeclarationListType; typedef std::vector<Ice::FunctionDeclaration *> FunctionDeclarationListType;
TopLevelParser(Ice::Translator &Translator, NaClBitcodeHeader &Header, TopLevelParser(Ice::Translator &Translator, NaClBitstreamCursor &Cursor,
NaClBitstreamCursor &Cursor, Ice::ErrorCode &ErrorStatus) Ice::ErrorCode &ErrorStatus)
: NaClBitcodeParser(Cursor), Translator(Translator), Header(Header), : NaClBitcodeParser(Cursor), Translator(Translator),
ErrorStatus(ErrorStatus), NumErrors(0), NextDefiningFunctionID(0), ErrorStatus(ErrorStatus), NumErrors(0), NextDefiningFunctionID(0),
VariableDeclarations(new Ice::VariableDeclarationList()), VariableDeclarations(new Ice::VariableDeclarationList()),
BlockParser(nullptr), StubbedConstCallValue(nullptr) {} BlockParser(nullptr), StubbedConstCallValue(nullptr) {}
...@@ -177,19 +177,17 @@ public: ...@@ -177,19 +177,17 @@ public:
BlockParser = NewBlockParser; BlockParser = NewBlockParser;
} }
// Generates error with given Message. Always returns true. /// Generates error with given Message, occurring at BitPosition
bool Error(const std::string &Message) override; /// within the bitcode file. Always returns true.
bool ErrorAt(uint64_t BitPosition, const std::string &Message) final;
// Generates error message with respect to the current block parser. /// Generates error message with respect to the current block parser.
bool BlockError(const std::string &Message); bool BlockError(const std::string &Message);
/// Returns the number of errors found while parsing the bitcode /// Returns the number of errors found while parsing the bitcode
/// file. /// file.
unsigned getNumErrors() const { return NumErrors; } unsigned getNumErrors() const { return NumErrors; }
/// Returns the number of bytes in the bitcode header.
size_t getHeaderSize() const { return Header.getHeaderSize(); }
/// Changes the size of the type list to the given size. /// Changes the size of the type list to the given size.
void resizeTypeIDValues(unsigned NewSize) { TypeIDValues.resize(NewSize); } void resizeTypeIDValues(unsigned NewSize) { TypeIDValues.resize(NewSize); }
...@@ -243,8 +241,7 @@ public: ...@@ -243,8 +241,7 @@ public:
FunctionDeclarationList[NextDefiningFunctionID]->isProto()) FunctionDeclarationList[NextDefiningFunctionID]->isProto())
++NextDefiningFunctionID; ++NextDefiningFunctionID;
if (NextDefiningFunctionID >= NumDeclaredFunctions) if (NextDefiningFunctionID >= NumDeclaredFunctions)
report_fatal_error( Fatal("More function blocks than defined function addresses");
"More function blocks than defined function addresses");
return NextDefiningFunctionID++; return NextDefiningFunctionID++;
} }
...@@ -361,8 +358,6 @@ public: ...@@ -361,8 +358,6 @@ public:
private: private:
// The translator associated with the parser. // The translator associated with the parser.
Ice::Translator &Translator; Ice::Translator &Translator;
// The bitcode header.
NaClBitcodeHeader &Header;
// The exit status that should be set to true if an error occurs. // The exit status that should be set to true if an error occurs.
Ice::ErrorCode &ErrorStatus; Ice::ErrorCode &ErrorStatus;
// The number of errors reported. // The number of errors reported.
...@@ -505,16 +500,16 @@ private: ...@@ -505,16 +500,16 @@ private:
Ice::Type convertToIceTypeError(Type *LLVMTy); Ice::Type convertToIceTypeError(Type *LLVMTy);
}; };
bool TopLevelParser::Error(const std::string &Message) { bool TopLevelParser::ErrorAt(uint64_t Bit, const std::string &Message) {
ErrorStatus.assign(Ice::EC_Bitcode); ErrorStatus.assign(Ice::EC_Bitcode);
++NumErrors; ++NumErrors;
Ice::GlobalContext *Context = Translator.getContext(); Ice::GlobalContext *Context = Translator.getContext();
Ice::OstreamLocker L(Context); Ice::OstreamLocker L(Context);
raw_ostream &OldErrStream = setErrStream(Context->getStrDump()); raw_ostream &OldErrStream = setErrStream(Context->getStrDump());
NaClBitcodeParser::Error(Message); NaClBitcodeParser::ErrorAt(Bit, Message);
setErrStream(OldErrStream); setErrStream(OldErrStream);
if (!Translator.getFlags().getAllowErrorRecovery()) if (!Translator.getFlags().getAllowErrorRecovery())
report_fatal_error("Unable to continue"); Fatal();
return true; return true;
} }
...@@ -541,7 +536,7 @@ TopLevelParser::reportGetFunctionByIDError(unsigned ID) { ...@@ -541,7 +536,7 @@ TopLevelParser::reportGetFunctionByIDError(unsigned ID) {
// TODO(kschimpf) Remove error recovery once implementation complete. // TODO(kschimpf) Remove error recovery once implementation complete.
if (!FunctionDeclarationList.empty()) if (!FunctionDeclarationList.empty())
return FunctionDeclarationList[0]; return FunctionDeclarationList[0];
report_fatal_error("Unable to continue"); Fatal();
} }
Ice::VariableDeclaration * Ice::VariableDeclaration *
...@@ -555,7 +550,7 @@ TopLevelParser::reportGetGlobalVariableByIDError(unsigned Index) { ...@@ -555,7 +550,7 @@ TopLevelParser::reportGetGlobalVariableByIDError(unsigned Index) {
// TODO(kschimpf) Remove error recovery once implementation complete. // TODO(kschimpf) Remove error recovery once implementation complete.
if (!VariableDeclarations->empty()) if (!VariableDeclarations->empty())
return VariableDeclarations->at(0); return VariableDeclarations->at(0);
report_fatal_error("Unable to continue"); Fatal();
} }
Ice::Type TopLevelParser::convertToIceTypeError(Type *LLVMTy) { Ice::Type TopLevelParser::convertToIceTypeError(Type *LLVMTy) {
...@@ -590,8 +585,8 @@ public: ...@@ -590,8 +585,8 @@ public:
return "unknown"; return "unknown";
} }
// Generates an error Message with the bit address prefixed to it. // Generates an error Message with the Bit address prefixed to it.
bool Error(const std::string &Message) override; bool ErrorAt(uint64_t Bit, const std::string &Message) final;
protected: protected:
// The context parser that contains the decoded state. // The context parser that contains the decoded state.
...@@ -678,12 +673,9 @@ bool TopLevelParser::BlockError(const std::string &Message) { ...@@ -678,12 +673,9 @@ bool TopLevelParser::BlockError(const std::string &Message) {
} }
// Generates an error Message with the bit address prefixed to it. // Generates an error Message with the bit address prefixed to it.
bool BlockParserBaseClass::Error(const std::string &Message) { bool BlockParserBaseClass::ErrorAt(uint64_t Bit, const std::string &Message) {
uint64_t Bit = Record.GetStartBit() + Context->getHeaderSize() * 8;
std::string Buffer; std::string Buffer;
raw_string_ostream StrBuf(Buffer); raw_string_ostream StrBuf(Buffer);
StrBuf << "(" << format("%" PRIu64 ":%u", (Bit / 8),
static_cast<unsigned>(Bit % 8)) << ") ";
// Note: If dump routines have been turned off, the error messages // Note: If dump routines have been turned off, the error messages
// will not be readable. Hence, replace with simple error. We also // will not be readable. Hence, replace with simple error. We also
// use the simple form for unit tests. // use the simple form for unit tests.
...@@ -696,7 +688,7 @@ bool BlockParserBaseClass::Error(const std::string &Message) { ...@@ -696,7 +688,7 @@ bool BlockParserBaseClass::Error(const std::string &Message) {
} else { } else {
StrBuf << Message; StrBuf << Message;
} }
return Context->Error(StrBuf.str()); return Context->ErrorAt(Bit, StrBuf.str());
} }
void BlockParserBaseClass::ReportRecordSizeError(unsigned ExpectedSize, void BlockParserBaseClass::ReportRecordSizeError(unsigned ExpectedSize,
...@@ -1235,8 +1227,7 @@ public: ...@@ -1235,8 +1227,7 @@ public:
std::string Buffer; std::string Buffer;
raw_string_ostream StrBuf(Buffer); raw_string_ostream StrBuf(Buffer);
StrBuf << "Value index " << Index << " not defined!"; StrBuf << "Value index " << Index << " not defined!";
Error(StrBuf.str()); Fatal(StrBuf.str());
report_fatal_error("Unable to continue");
} }
Ice::Operand *Op = LocalOperands[LocalIndex]; Ice::Operand *Op = LocalOperands[LocalIndex];
if (Op == nullptr) { if (Op == nullptr) {
...@@ -1245,8 +1236,7 @@ public: ...@@ -1245,8 +1236,7 @@ public:
std::string Buffer; std::string Buffer;
raw_string_ostream StrBuf(Buffer); raw_string_ostream StrBuf(Buffer);
StrBuf << "Value index " << Index << " not defined!"; StrBuf << "Value index " << Index << " not defined!";
Error(StrBuf.str()); Fatal(StrBuf.str());
report_fatal_error("Unable to continue");
} }
return Op; return Op;
} }
...@@ -3025,21 +3015,23 @@ void PNaClTranslator::translateBuffer(const std::string &IRFilename, ...@@ -3025,21 +3015,23 @@ void PNaClTranslator::translateBuffer(const std::string &IRFilename,
} }
const unsigned char *BufPtr = (const unsigned char *)MemBuf->getBufferStart(); const unsigned char *BufPtr = (const unsigned char *)MemBuf->getBufferStart();
const unsigned char *HeaderPtr = BufPtr;
const unsigned char *EndBufPtr = BufPtr + MemBuf->getBufferSize(); const unsigned char *EndBufPtr = BufPtr + MemBuf->getBufferSize();
// Read header and verify it is good. // Read header and verify it is good.
NaClBitcodeHeader Header; NaClBitcodeHeader Header;
if (Header.Read(BufPtr, EndBufPtr) || !Header.IsSupported()) { if (Header.Read(HeaderPtr, EndBufPtr) || !Header.IsSupported()) {
errs() << "Invalid PNaCl bitcode header.\n"; errs() << "Invalid PNaCl bitcode header.\n";
ErrorStatus.assign(EC_Bitcode); ErrorStatus.assign(EC_Bitcode);
return; return;
} }
// Create a bitstream reader to read the bitcode file. // Create a bitstream reader to read the bitcode file.
NaClBitstreamReader InputStreamFile(BufPtr, EndBufPtr); NaClBitstreamReader InputStreamFile(BufPtr, EndBufPtr,
Header.getHeaderSize());
NaClBitstreamCursor InputStream(InputStreamFile); NaClBitstreamCursor InputStream(InputStreamFile);
TopLevelParser Parser(*this, Header, InputStream, ErrorStatus); TopLevelParser Parser(*this, InputStream, ErrorStatus);
int TopLevelBlocks = 0; int TopLevelBlocks = 0;
while (!InputStream.AtEndOfStream()) { while (!InputStream.AtEndOfStream()) {
if (Parser.Parse()) { if (Parser.Parse()) {
......
...@@ -14,183 +14,183 @@ ...@@ -14,183 +14,183 @@
define void @ExtractV4xi1(<4 x i1> %v, i32 %i) { define void @ExtractV4xi1(<4 x i1> %v, i32 %i) {
%e0 = extractelement <4 x i1> %v, i32 %i %e0 = extractelement <4 x i1> %v, i32 %i
; CHECK: Error: {{.*}} not {{.*}} constant ; CHECK: Error{{.*}} not {{.*}} constant
; MIN: Error: {{.*}} Invalid function record: <6 4 3> ; MIN: Error{{.*}} Invalid function record: <6 4 3>
%e1 = extractelement <4 x i1> %v, i32 4 %e1 = extractelement <4 x i1> %v, i32 4
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <6 5 3> ; MIN: Error{{.*}} Invalid function record: <6 5 3>
%e2 = extractelement <4 x i1> %v, i32 9 %e2 = extractelement <4 x i1> %v, i32 9
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <6 6 3> ; MIN: Error{{.*}} Invalid function record: <6 6 3>
ret void ret void
} }
define void @ExtractV8xi1(<8 x i1> %v, i32 %i) { define void @ExtractV8xi1(<8 x i1> %v, i32 %i) {
%e0 = extractelement <8 x i1> %v, i32 %i %e0 = extractelement <8 x i1> %v, i32 %i
; CHECK: Error: {{.*}} not {{.*}} constant ; CHECK: Error{{.*}} not {{.*}} constant
; MIN: Error: {{.*}} Invalid function record: <6 4 3> ; MIN: Error{{.*}} Invalid function record: <6 4 3>
%e1 = extractelement <8 x i1> %v, i32 8; %e1 = extractelement <8 x i1> %v, i32 8;
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <6 5 3> ; MIN: Error{{.*}} Invalid function record: <6 5 3>
%e2 = extractelement <8 x i1> %v, i32 9; %e2 = extractelement <8 x i1> %v, i32 9;
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <6 6 3> ; MIN: Error{{.*}} Invalid function record: <6 6 3>
ret void ret void
} }
define void @ExtractV16xi1(<16 x i1> %v, i32 %i) { define void @ExtractV16xi1(<16 x i1> %v, i32 %i) {
%e0 = extractelement <16 x i1> %v, i32 %i %e0 = extractelement <16 x i1> %v, i32 %i
; CHECK: Error: {{.*}} not {{.*}} constant ; CHECK: Error{{.*}} not {{.*}} constant
; MIN: Error: {{.*}} Invalid function record: <6 4 3> ; MIN: Error{{.*}} Invalid function record: <6 4 3>
%e1 = extractelement <16 x i1> %v, i32 16 %e1 = extractelement <16 x i1> %v, i32 16
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <6 5 3> ; MIN: Error{{.*}} Invalid function record: <6 5 3>
%e2 = extractelement <16 x i1> %v, i32 24 %e2 = extractelement <16 x i1> %v, i32 24
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <6 6 3> ; MIN: Error{{.*}} Invalid function record: <6 6 3>
ret void ret void
} }
define void @ExtractV16xi8(<16 x i8> %v, i32 %i) { define void @ExtractV16xi8(<16 x i8> %v, i32 %i) {
%e0 = extractelement <16 x i8> %v, i32 %i %e0 = extractelement <16 x i8> %v, i32 %i
; CHECK: Error: {{.*}} not {{.*}} constant ; CHECK: Error{{.*}} not {{.*}} constant
; MIN: Error: {{.*}} Invalid function record: <6 4 3> ; MIN: Error{{.*}} Invalid function record: <6 4 3>
%e1 = extractelement <16 x i8> %v, i32 16 %e1 = extractelement <16 x i8> %v, i32 16
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <6 5 3> ; MIN: Error{{.*}} Invalid function record: <6 5 3>
%e2 = extractelement <16 x i8> %v, i32 71 %e2 = extractelement <16 x i8> %v, i32 71
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <6 6 3> ; MIN: Error{{.*}} Invalid function record: <6 6 3>
ret void ret void
} }
define void @ExtractV8xi16(<8 x i16> %v, i32 %i) { define void @ExtractV8xi16(<8 x i16> %v, i32 %i) {
%e0 = extractelement <8 x i16> %v, i32 %i %e0 = extractelement <8 x i16> %v, i32 %i
; CHECK: Error: {{.*}} not {{.*}} constant ; CHECK: Error{{.*}} not {{.*}} constant
; MIN: Error: {{.*}} Invalid function record: <6 4 3> ; MIN: Error{{.*}} Invalid function record: <6 4 3>
%e1 = extractelement <8 x i16> %v, i32 8 %e1 = extractelement <8 x i16> %v, i32 8
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <6 5 3> ; MIN: Error{{.*}} Invalid function record: <6 5 3>
%e2 = extractelement <8 x i16> %v, i32 15 %e2 = extractelement <8 x i16> %v, i32 15
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <6 6 3> ; MIN: Error{{.*}} Invalid function record: <6 6 3>
ret void ret void
} }
define i32 @ExtractV4xi32(<4 x i32> %v, i32 %i) { define i32 @ExtractV4xi32(<4 x i32> %v, i32 %i) {
%e0 = extractelement <4 x i32> %v, i32 %i %e0 = extractelement <4 x i32> %v, i32 %i
; CHECK: Error: {{.*}} not {{.*}} constant ; CHECK: Error{{.*}} not {{.*}} constant
; MIN: Error: {{.*}} Invalid function record: <6 4 3> ; MIN: Error{{.*}} Invalid function record: <6 4 3>
%e1 = extractelement <4 x i32> %v, i32 4 %e1 = extractelement <4 x i32> %v, i32 4
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <6 5 3> ; MIN: Error{{.*}} Invalid function record: <6 5 3>
%e2 = extractelement <4 x i32> %v, i32 17 %e2 = extractelement <4 x i32> %v, i32 17
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <6 6 3> ; MIN: Error{{.*}} Invalid function record: <6 6 3>
ret i32 %e0 ret i32 %e0
} }
define float @ExtractV4xfloat(<4 x float> %v, i32 %i) { define float @ExtractV4xfloat(<4 x float> %v, i32 %i) {
%e0 = extractelement <4 x float> %v, i32 %i %e0 = extractelement <4 x float> %v, i32 %i
; CHECK: Error: {{.*}} not {{.*}} constant ; CHECK: Error{{.*}} not {{.*}} constant
; MIN: Error: {{.*}} Invalid function record: <6 3 2> ; MIN: Error{{.*}} Invalid function record: <6 3 2>
%e1 = extractelement <4 x float> %v, i32 4 %e1 = extractelement <4 x float> %v, i32 4
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <6 4 2> ; MIN: Error{{.*}} Invalid function record: <6 4 2>
%e2 = extractelement <4 x float> %v, i32 4 %e2 = extractelement <4 x float> %v, i32 4
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <6 5 3> ; MIN: Error{{.*}} Invalid function record: <6 5 3>
ret float %e2 ret float %e2
} }
define <4 x i1> @InsertV4xi1(<4 x i1> %v, i32 %i) { define <4 x i1> @InsertV4xi1(<4 x i1> %v, i32 %i) {
%r0 = insertelement <4 x i1> %v, i1 1, i32 %i %r0 = insertelement <4 x i1> %v, i1 1, i32 %i
; CHECK: Error: {{.*}} not {{.*}} constant ; CHECK: Error{{.*}} not {{.*}} constant
; MIN: Error: {{.*}} Invalid function record: <7 5 1 4> ; MIN: Error{{.*}} Invalid function record: <7 5 1 4>
%r1 = insertelement <4 x i1> %v, i1 1, i32 4 %r1 = insertelement <4 x i1> %v, i1 1, i32 4
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <7 6 2 4> ; MIN: Error{{.*}} Invalid function record: <7 6 2 4>
%r2 = insertelement <4 x i1> %v, i1 1, i32 7 %r2 = insertelement <4 x i1> %v, i1 1, i32 7
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <7 7 3 4> ; MIN: Error{{.*}} Invalid function record: <7 7 3 4>
ret <4 x i1> %r2 ret <4 x i1> %r2
} }
define <8 x i1> @InsertV8xi1(<8 x i1> %v, i32 %i) { define <8 x i1> @InsertV8xi1(<8 x i1> %v, i32 %i) {
%r0 = insertelement <8 x i1> %v, i1 0, i32 %i %r0 = insertelement <8 x i1> %v, i1 0, i32 %i
; CHECK: Error: {{.*}} not {{.*}} constant ; CHECK: Error{{.*}} not {{.*}} constant
; MIN: Error: {{.*}} Invalid function record: <7 5 1 4> ; MIN: Error{{.*}} Invalid function record: <7 5 1 4>
%r1 = insertelement <8 x i1> %v, i1 0, i32 8 %r1 = insertelement <8 x i1> %v, i1 0, i32 8
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <7 6 2 4> ; MIN: Error{{.*}} Invalid function record: <7 6 2 4>
%r2 = insertelement <8 x i1> %v, i1 0, i32 88 %r2 = insertelement <8 x i1> %v, i1 0, i32 88
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <7 7 3 4> ; MIN: Error{{.*}} Invalid function record: <7 7 3 4>
ret <8 x i1> %r2 ret <8 x i1> %r2
} }
define <16 x i1> @InsertV16xi1(<16 x i1> %v, i32 %i) { define <16 x i1> @InsertV16xi1(<16 x i1> %v, i32 %i) {
%r = insertelement <16 x i1> %v, i1 1, i32 %i %r = insertelement <16 x i1> %v, i1 1, i32 %i
; CHECK: Error: {{.*}} not {{.*}} constant ; CHECK: Error{{.*}} not {{.*}} constant
; MIN: Error: {{.*}} Invalid function record: <7 5 1 4> ; MIN: Error{{.*}} Invalid function record: <7 5 1 4>
ret <16 x i1> %r ret <16 x i1> %r
%r1 = insertelement <16 x i1> %v, i1 1, i32 16 %r1 = insertelement <16 x i1> %v, i1 1, i32 16
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <7 6 2 4> ; MIN: Error{{.*}} Invalid function record: <7 6 2 4>
%r2 = insertelement <16 x i1> %v, i1 1, i32 31 %r2 = insertelement <16 x i1> %v, i1 1, i32 31
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <7 7 3 4> ; MIN: Error{{.*}} Invalid function record: <7 7 3 4>
ret <16 x i1> %r2 ret <16 x i1> %r2
} }
define <16 x i8> @InsertV16xi8(<16 x i8> %v, i32 %i) { define <16 x i8> @InsertV16xi8(<16 x i8> %v, i32 %i) {
%r0 = insertelement <16 x i8> %v, i8 34, i32 %i %r0 = insertelement <16 x i8> %v, i8 34, i32 %i
; CHECK: Error: {{.*}} not {{.*}} constant ; CHECK: Error{{.*}} not {{.*}} constant
; MIN: Error: {{.*}} Invalid function record: <7 5 1 4> ; MIN: Error{{.*}} Invalid function record: <7 5 1 4>
%r1 = insertelement <16 x i8> %v, i8 34, i32 16 %r1 = insertelement <16 x i8> %v, i8 34, i32 16
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <7 6 2 4> ; MIN: Error{{.*}} Invalid function record: <7 6 2 4>
%r2 = insertelement <16 x i8> %v, i8 34, i32 19 %r2 = insertelement <16 x i8> %v, i8 34, i32 19
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <7 7 3 4> ; MIN: Error{{.*}} Invalid function record: <7 7 3 4>
ret <16 x i8> %r0 ret <16 x i8> %r0
} }
define <8 x i16> @InsertV8xi16(<8 x i16> %v, i32 %i) { define <8 x i16> @InsertV8xi16(<8 x i16> %v, i32 %i) {
%r0 = insertelement <8 x i16> %v, i16 289, i32 %i %r0 = insertelement <8 x i16> %v, i16 289, i32 %i
; CHECK: Error: {{.*}} not {{.*}} constant ; CHECK: Error{{.*}} not {{.*}} constant
; MIN: Error: {{.*}} Invalid function record: <7 5 1 4> ; MIN: Error{{.*}} Invalid function record: <7 5 1 4>
%r1 = insertelement <8 x i16> %v, i16 289, i32 8 %r1 = insertelement <8 x i16> %v, i16 289, i32 8
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <7 6 2 4> ; MIN: Error{{.*}} Invalid function record: <7 6 2 4>
%r2 = insertelement <8 x i16> %v, i16 289, i32 19 %r2 = insertelement <8 x i16> %v, i16 289, i32 19
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <7 7 3 4> ; MIN: Error{{.*}} Invalid function record: <7 7 3 4>
ret <8 x i16> %r1 ret <8 x i16> %r1
} }
define <4 x i32> @InsertV4xi32(<4 x i32> %v, i32 %i) { define <4 x i32> @InsertV4xi32(<4 x i32> %v, i32 %i) {
%r0 = insertelement <4 x i32> %v, i32 54545454, i32 %i %r0 = insertelement <4 x i32> %v, i32 54545454, i32 %i
; CHECK: Error: {{.*}} not {{.*}} constant ; CHECK: Error{{.*}} not {{.*}} constant
; MIN: Error: {{.*}} Invalid function record: <7 5 3 4> ; MIN: Error{{.*}} Invalid function record: <7 5 3 4>
%r1 = insertelement <4 x i32> %v, i32 54545454, i32 4 %r1 = insertelement <4 x i32> %v, i32 54545454, i32 4
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <7 6 4 3> ; MIN: Error{{.*}} Invalid function record: <7 6 4 3>
%r2 = insertelement <4 x i32> %v, i32 54545454, i32 9 %r2 = insertelement <4 x i32> %v, i32 54545454, i32 9
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <7 7 5 3> ; MIN: Error{{.*}} Invalid function record: <7 7 5 3>
ret <4 x i32> %r2 ret <4 x i32> %r2
} }
define <4 x float> @InsertV4xfloat(<4 x float> %v, i32 %i) { define <4 x float> @InsertV4xfloat(<4 x float> %v, i32 %i) {
%r0 = insertelement <4 x float> %v, float 3.0, i32 %i %r0 = insertelement <4 x float> %v, float 3.0, i32 %i
; CHECK: Error: {{.*}} not {{.*}} constant ; CHECK: Error{{.*}} not {{.*}} constant
; MIN: Error: {{.*}} Invalid function record: <7 5 1 4> ; MIN: Error{{.*}} Invalid function record: <7 5 1 4>
%r1 = insertelement <4 x float> %v, float 3.0, i32 4 %r1 = insertelement <4 x float> %v, float 3.0, i32 4
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <7 6 2 4> ; MIN: Error{{.*}} Invalid function record: <7 6 2 4>
%r2 = insertelement <4 x float> %v, float 3.0, i32 44 %r2 = insertelement <4 x float> %v, float 3.0, i32 44
; CHECK: Error: {{.*}} not in range ; CHECK: Error{{.*}} not in range
; MIN: Error: {{.*}} Invalid function record: <7 7 3 4> ; MIN: Error{{.*}} Invalid function record: <7 7 3 4>
ret <4 x float> %r2 ret <4 x float> %r2
} }
...@@ -28,5 +28,5 @@ define i32 @testFake(i32 %v) { ...@@ -28,5 +28,5 @@ define i32 @testFake(i32 %v) {
ret i32 %r ret i32 %r
} }
; CHECK: Error: ({{.*}}) Invalid PNaCl intrinsic call to llvm.fake.i32 ; CHECK: Error({{.*}}): Invalid PNaCl intrinsic call to llvm.fake.i32
; MIN: Error: ({{.*}}) Invalid function record: <34 0 3 1> ; MIN: Error({{.*}}): Invalid function record: <34 0 3 1>
...@@ -51,33 +51,17 @@ TEST(IceParseInstsTest, NonexistentCallArg) { ...@@ -51,33 +51,17 @@ TEST(IceParseInstsTest, NonexistentCallArg) {
// Show bitcode objdump for BitcodeRecords. // Show bitcode objdump for BitcodeRecords.
NaClObjDumpMunger DumpMunger(BitcodeRecords, NaClObjDumpMunger DumpMunger(BitcodeRecords,
array_lengthof(BitcodeRecords), Terminator); array_lengthof(BitcodeRecords), Terminator);
EXPECT_FALSE(DumpMunger.runTestForAssembly("Nonexistent call arg")); EXPECT_FALSE(DumpMunger.runTest("Nonexistent call arg"));
EXPECT_EQ( EXPECT_EQ(" 66:4| 3: <34, 0, 4, 2, 100> | call void @f0(i32 "
"module { // BlockID = 8\n" "%p0, i32 @f0);\n"
" types { // BlockID = 17\n" "Error(66:4): Invalid relative value id: 100 (Must be <= 4)\n",
" count 3;\n" DumpMunger.getLinesWithSubstring("66:4"));
" @t0 = i32;\n"
" @t1 = void;\n"
" @t2 = void (i32, i32);\n"
" }\n"
" declare external void @f0(i32, i32);\n"
" define external void @f1(i32, i32);\n"
" function void @f1(i32 %p0, i32 %p1) { // BlockID = 12\n"
" blocks 1;\n"
" %b0:\n"
" call void @f0(i32 %p0, i32 @f0);\n"
"Error(66:4): Invalid relative value id: 100 (Must be <= 4)\n"
" ret void;\n"
" }\n"
"}\n",
DumpMunger.getTestResults());
// Show that we get appropriate error when parsing in Subzero. // Show that we get appropriate error when parsing in Subzero.
IceTest::SubzeroBitcodeMunger Munger( IceTest::SubzeroBitcodeMunger Munger(
BitcodeRecords, array_lengthof(BitcodeRecords), Terminator); BitcodeRecords, array_lengthof(BitcodeRecords), Terminator);
EXPECT_FALSE(Munger.runTest("Nonexistent call arg")); EXPECT_FALSE(Munger.runTest("Nonexistent call arg"));
EXPECT_EQ( EXPECT_EQ("Error(66:4): Invalid function record: <34 0 4 2 100>\n",
"Error: (66:4) Invalid function record: <34 0 4 2 100>\n",
Munger.getTestResults()); Munger.getTestResults());
} }
...@@ -105,24 +89,10 @@ TEST(IceParseInstsTests, AllocaAlignment) { ...@@ -105,24 +89,10 @@ TEST(IceParseInstsTests, AllocaAlignment) {
// Show text when alignment is 1. // Show text when alignment is 1.
NaClObjDumpMunger DumpMunger(BitcodeRecords, array_lengthof(BitcodeRecords), NaClObjDumpMunger DumpMunger(BitcodeRecords, array_lengthof(BitcodeRecords),
Terminator); Terminator);
EXPECT_TRUE(DumpMunger.runTestForAssembly("Good alloca alignment 1")); EXPECT_TRUE(DumpMunger.runTest("Good alloca alignment 1"));
EXPECT_EQ("module { // BlockID = 8\n" EXPECT_EQ(" 62:4| 3: <19, 1, 1> | %v0 = alloca i8, i32 "
" types { // BlockID = 17\n" "%p0, align 1;\n",
" count 4;\n" DumpMunger.getLinesWithSubstring("62:4"));
" @t0 = i32;\n"
" @t1 = void;\n"
" @t2 = void (i32);\n"
" @t3 = i8;\n"
" }\n"
" define external void @f0(i32);\n"
" function void @f0(i32 %p0) { // BlockID = 12\n"
" blocks 1;\n"
" %b0:\n"
" %v0 = alloca i8, i32 %p0, align 1;\n"
" ret void;\n"
" }\n"
"}\n",
DumpMunger.getTestResults());
// Show that we can handle alignment of 1. // Show that we can handle alignment of 1.
IceTest::SubzeroBitcodeMunger Munger( IceTest::SubzeroBitcodeMunger Munger(
...@@ -148,7 +118,7 @@ TEST(IceParseInstsTests, AllocaAlignment) { ...@@ -148,7 +118,7 @@ TEST(IceParseInstsTests, AllocaAlignment) {
}; };
EXPECT_FALSE(Munger.runTest("Bad alloca alignment 30", Align30, EXPECT_FALSE(Munger.runTest("Bad alloca alignment 30", Align30,
array_lengthof(Align30))); array_lengthof(Align30)));
EXPECT_EQ("Error: (62:4) Invalid function record: <19 1 31>\n", EXPECT_EQ("Error(62:4): Invalid function record: <19 1 31>\n",
Munger.getTestResults()); Munger.getTestResults());
EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad alloca alignment 30", Align30, EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad alloca alignment 30", Align30,
...@@ -194,22 +164,10 @@ TEST(IceParseInstsTests, LoadI32Alignment) { ...@@ -194,22 +164,10 @@ TEST(IceParseInstsTests, LoadI32Alignment) {
// Show text when alignment is 1. // Show text when alignment is 1.
NaClObjDumpMunger DumpMunger(BitcodeRecords, array_lengthof(BitcodeRecords), NaClObjDumpMunger DumpMunger(BitcodeRecords, array_lengthof(BitcodeRecords),
Terminator); Terminator);
EXPECT_TRUE(DumpMunger.runTestForAssembly("Good load i32 alignment 1")); EXPECT_TRUE(DumpMunger.runTest("Good load i32 alignment 1"));
EXPECT_EQ("module { // BlockID = 8\n" EXPECT_EQ(" 58:4| 3: <20, 1, 1, 0> | %v0 = load i32* %p0, "
" types { // BlockID = 17\n" "align 1;\n",
" count 2;\n" DumpMunger.getLinesWithSubstring("58:4"));
" @t0 = i32;\n"
" @t1 = i32 (i32);\n"
" }\n"
" define external i32 @f0(i32);\n"
" function i32 @f0(i32 %p0) { // BlockID = 12\n"
" blocks 1;\n"
" %b0:\n"
" %v0 = load i32* %p0, align 1;\n"
" ret i32 %v0;\n"
" }\n"
"}\n",
DumpMunger.getTestResults());
IceTest::SubzeroBitcodeMunger Munger( IceTest::SubzeroBitcodeMunger Munger(
BitcodeRecords, array_lengthof(BitcodeRecords), Terminator); BitcodeRecords, array_lengthof(BitcodeRecords), Terminator);
EXPECT_TRUE(Munger.runTest("Good load i32 alignment 1")); EXPECT_TRUE(Munger.runTest("Good load i32 alignment 1"));
...@@ -221,7 +179,7 @@ TEST(IceParseInstsTests, LoadI32Alignment) { ...@@ -221,7 +179,7 @@ TEST(IceParseInstsTests, LoadI32Alignment) {
}; };
EXPECT_FALSE(Munger.runTest("Bad load i32 alignment 0", Align0, EXPECT_FALSE(Munger.runTest("Bad load i32 alignment 0", Align0,
array_lengthof(Align0))); array_lengthof(Align0)));
EXPECT_EQ("Error: (58:4) Invalid function record: <20 1 0 0>\n", EXPECT_EQ("Error(58:4): Invalid function record: <20 1 0 0>\n",
Munger.getTestResults()); Munger.getTestResults());
EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad load i32 alignment 0", Align0, EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad load i32 alignment 0", Align0,
array_lengthof(Align0))); array_lengthof(Align0)));
...@@ -236,7 +194,7 @@ TEST(IceParseInstsTests, LoadI32Alignment) { ...@@ -236,7 +194,7 @@ TEST(IceParseInstsTests, LoadI32Alignment) {
}; };
EXPECT_FALSE(Munger.runTest("Bad load i32 alignment 4", Align4, EXPECT_FALSE(Munger.runTest("Bad load i32 alignment 4", Align4,
array_lengthof(Align4))); array_lengthof(Align4)));
EXPECT_EQ("Error: (58:4) Invalid function record: <20 1 3 0>\n", EXPECT_EQ("Error(58:4): Invalid function record: <20 1 3 0>\n",
Munger.getTestResults()); Munger.getTestResults());
EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad load i32 alignment 4", Align4, EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad load i32 alignment 4", Align4,
array_lengthof(Align4))); array_lengthof(Align4)));
...@@ -251,7 +209,7 @@ TEST(IceParseInstsTests, LoadI32Alignment) { ...@@ -251,7 +209,7 @@ TEST(IceParseInstsTests, LoadI32Alignment) {
}; };
EXPECT_FALSE(Munger.runTest("Bad load i32 alignment 29", Align29, EXPECT_FALSE(Munger.runTest("Bad load i32 alignment 29", Align29,
array_lengthof(Align29))); array_lengthof(Align29)));
EXPECT_EQ("Error: (58:4) Invalid function record: <20 1 30 0>\n", EXPECT_EQ("Error(58:4): Invalid function record: <20 1 30 0>\n",
Munger.getTestResults()); Munger.getTestResults());
EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad load i32 alignment 29", EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad load i32 alignment 29",
Align29, array_lengthof(Align29))); Align29, array_lengthof(Align29)));
...@@ -266,7 +224,7 @@ TEST(IceParseInstsTests, LoadI32Alignment) { ...@@ -266,7 +224,7 @@ TEST(IceParseInstsTests, LoadI32Alignment) {
}; };
EXPECT_FALSE(Munger.runTest("Bad load i32 alignment 30", Align30, EXPECT_FALSE(Munger.runTest("Bad load i32 alignment 30", Align30,
array_lengthof(Align30))); array_lengthof(Align30)));
EXPECT_EQ("Error: (58:4) Invalid function record: <20 1 31 0>\n", EXPECT_EQ("Error(58:4): Invalid function record: <20 1 31 0>\n",
Munger.getTestResults()); Munger.getTestResults());
EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad load i32 alignment 30", EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad load i32 alignment 30",
Align30, array_lengthof(Align30))); Align30, array_lengthof(Align30)));
...@@ -298,23 +256,10 @@ TEST(IceParseInstsTests, LoadFloatAlignment) { ...@@ -298,23 +256,10 @@ TEST(IceParseInstsTests, LoadFloatAlignment) {
// Show text when alignment is 1. // Show text when alignment is 1.
NaClObjDumpMunger DumpMunger(BitcodeRecords, array_lengthof(BitcodeRecords), NaClObjDumpMunger DumpMunger(BitcodeRecords, array_lengthof(BitcodeRecords),
Terminator); Terminator);
EXPECT_TRUE(DumpMunger.runTestForAssembly("Good load float alignment 1")); EXPECT_TRUE(DumpMunger.runTest("Good load float alignment 1"));
EXPECT_EQ("module { // BlockID = 8\n" EXPECT_EQ(" 58:4| 3: <20, 1, 1, 0> | %v0 = load float* "
" types { // BlockID = 17\n" "%p0, align 1;\n",
" count 3;\n" DumpMunger.getLinesWithSubstring("58:4"));
" @t0 = float;\n"
" @t1 = i32;\n"
" @t2 = float (i32);\n"
" }\n"
" define external float @f0(i32);\n"
" function float @f0(i32 %p0) { // BlockID = 12\n"
" blocks 1;\n"
" %b0:\n"
" %v0 = load float* %p0, align 1;\n"
" ret float %v0;\n"
" }\n"
"}\n",
DumpMunger.getTestResults());
IceTest::SubzeroBitcodeMunger Munger( IceTest::SubzeroBitcodeMunger Munger(
BitcodeRecords, array_lengthof(BitcodeRecords), Terminator); BitcodeRecords, array_lengthof(BitcodeRecords), Terminator);
EXPECT_TRUE(Munger.runTest("Good load float alignment 1")); EXPECT_TRUE(Munger.runTest("Good load float alignment 1"));
...@@ -326,7 +271,7 @@ TEST(IceParseInstsTests, LoadFloatAlignment) { ...@@ -326,7 +271,7 @@ TEST(IceParseInstsTests, LoadFloatAlignment) {
}; };
EXPECT_FALSE(Munger.runTest("Bad load float alignment 0", Align0, EXPECT_FALSE(Munger.runTest("Bad load float alignment 0", Align0,
array_lengthof(Align0))); array_lengthof(Align0)));
EXPECT_EQ("Error: (58:4) Invalid function record: <20 1 0 0>\n", EXPECT_EQ("Error(58:4): Invalid function record: <20 1 0 0>\n",
Munger.getTestResults()); Munger.getTestResults());
EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad load float alignment 0", EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad load float alignment 0",
Align0, array_lengthof(Align0))); Align0, array_lengthof(Align0)));
...@@ -353,7 +298,7 @@ TEST(IceParseInstsTests, LoadFloatAlignment) { ...@@ -353,7 +298,7 @@ TEST(IceParseInstsTests, LoadFloatAlignment) {
}; };
EXPECT_FALSE(Munger.runTest("Bad load float alignment 29", Align29, EXPECT_FALSE(Munger.runTest("Bad load float alignment 29", Align29,
array_lengthof(Align29))); array_lengthof(Align29)));
EXPECT_EQ("Error: (58:4) Invalid function record: <20 1 30 0>\n", EXPECT_EQ("Error(58:4): Invalid function record: <20 1 30 0>\n",
Munger.getTestResults()); Munger.getTestResults());
EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad load float alignment 29", EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad load float alignment 29",
Align29, array_lengthof(Align29))); Align29, array_lengthof(Align29)));
...@@ -369,7 +314,7 @@ TEST(IceParseInstsTests, LoadFloatAlignment) { ...@@ -369,7 +314,7 @@ TEST(IceParseInstsTests, LoadFloatAlignment) {
}; };
EXPECT_FALSE(Munger.runTest("Bad load float alignment 30", Align30, EXPECT_FALSE(Munger.runTest("Bad load float alignment 30", Align30,
array_lengthof(Align30))); array_lengthof(Align30)));
EXPECT_EQ("Error: (58:4) Invalid function record: <20 1 31 0>\n", EXPECT_EQ("Error(58:4): Invalid function record: <20 1 31 0>\n",
Munger.getTestResults()); Munger.getTestResults());
EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad load float alignment 30", EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad load float alignment 30",
Align30, array_lengthof(Align30))); Align30, array_lengthof(Align30)));
...@@ -402,23 +347,10 @@ TEST(NaClParseInstsTests, StoreAlignment) { ...@@ -402,23 +347,10 @@ TEST(NaClParseInstsTests, StoreAlignment) {
// Show text when alignment is 1. // Show text when alignment is 1.
NaClObjDumpMunger DumpMunger(BitcodeRecords, array_lengthof(BitcodeRecords), NaClObjDumpMunger DumpMunger(BitcodeRecords, array_lengthof(BitcodeRecords),
Terminator); Terminator);
EXPECT_TRUE(DumpMunger.runTestForAssembly("Good Store Alignment 1")); EXPECT_TRUE(DumpMunger.runTest("Good Store Alignment 1"));
EXPECT_EQ("module { // BlockID = 8\n" EXPECT_EQ(" 62:4| 3: <24, 2, 1, 1> | store float %p1, "
" types { // BlockID = 17\n" "float* %p0, \n",
" count 3;\n" DumpMunger.getLinesWithSubstring("62:4"));
" @t0 = float;\n"
" @t1 = i32;\n"
" @t2 = float (i32, float);\n"
" }\n"
" define external float @f0(i32, float);\n"
" function float @f0(i32 %p0, float %p1) { // BlockID = 12\n"
" blocks 1;\n"
" %b0:\n"
" store float %p1, float* %p0, align 1;\n"
" ret float %p1;\n"
" }\n"
"}\n",
DumpMunger.getTestResults());
IceTest::SubzeroBitcodeMunger Munger( IceTest::SubzeroBitcodeMunger Munger(
BitcodeRecords, array_lengthof(BitcodeRecords), Terminator); BitcodeRecords, array_lengthof(BitcodeRecords), Terminator);
EXPECT_TRUE(Munger.runTest("Good store alignment")); EXPECT_TRUE(Munger.runTest("Good store alignment"));
...@@ -430,7 +362,7 @@ TEST(NaClParseInstsTests, StoreAlignment) { ...@@ -430,7 +362,7 @@ TEST(NaClParseInstsTests, StoreAlignment) {
}; };
EXPECT_FALSE( EXPECT_FALSE(
Munger.runTest("Bad store alignment 0", Align0, array_lengthof(Align0))); Munger.runTest("Bad store alignment 0", Align0, array_lengthof(Align0)));
EXPECT_EQ("Error: (62:4) Invalid function record: <24 2 1 0>\n", EXPECT_EQ("Error(62:4): Invalid function record: <24 2 1 0>\n",
Munger.getTestResults()); Munger.getTestResults());
EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad store alignment 0", Align0, EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad store alignment 0", Align0,
array_lengthof(Align0))); array_lengthof(Align0)));
...@@ -456,7 +388,7 @@ TEST(NaClParseInstsTests, StoreAlignment) { ...@@ -456,7 +388,7 @@ TEST(NaClParseInstsTests, StoreAlignment) {
}; };
EXPECT_FALSE( EXPECT_FALSE(
Munger.runTest("Bad store alignment 8", Align8, array_lengthof(Align8))); Munger.runTest("Bad store alignment 8", Align8, array_lengthof(Align8)));
EXPECT_EQ("Error: (62:4) Invalid function record: <24 2 1 4>\n", EXPECT_EQ("Error(62:4): Invalid function record: <24 2 1 4>\n",
Munger.getTestResults()); Munger.getTestResults());
EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad store alignment 8", Align8, EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad store alignment 8", Align8,
array_lengthof(Align8))); array_lengthof(Align8)));
...@@ -472,7 +404,7 @@ TEST(NaClParseInstsTests, StoreAlignment) { ...@@ -472,7 +404,7 @@ TEST(NaClParseInstsTests, StoreAlignment) {
}; };
EXPECT_FALSE(Munger.runTest("Bad store alignment 29", Align29, EXPECT_FALSE(Munger.runTest("Bad store alignment 29", Align29,
array_lengthof(Align29))); array_lengthof(Align29)));
EXPECT_EQ("Error: (62:4) Invalid function record: <24 2 1 30>\n", EXPECT_EQ("Error(62:4): Invalid function record: <24 2 1 30>\n",
Munger.getTestResults()); Munger.getTestResults());
EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad store alignment 29", Align29, EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad store alignment 29", Align29,
array_lengthof(Align29))); array_lengthof(Align29)));
...@@ -488,7 +420,7 @@ TEST(NaClParseInstsTests, StoreAlignment) { ...@@ -488,7 +420,7 @@ TEST(NaClParseInstsTests, StoreAlignment) {
}; };
EXPECT_FALSE(Munger.runTest("Bad store alignment 30", Align30, EXPECT_FALSE(Munger.runTest("Bad store alignment 30", Align30,
array_lengthof(Align30))); array_lengthof(Align30)));
EXPECT_EQ("Error: (62:4) Invalid function record: <24 2 1 31>\n", EXPECT_EQ("Error(62:4): Invalid function record: <24 2 1 31>\n",
Munger.getTestResults()); Munger.getTestResults());
EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad Store alignment 30", Align30, EXPECT_FALSE(DumpMunger.runTestForAssembly("Bad Store alignment 30", Align30,
array_lengthof(Align30))); array_lengthof(Align30)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment