Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: src/PNaClTranslator.cpp

Issue 1357273004: Check that element type correct in vector insert element. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nit. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests_lit/parse_errs/Inputs/insertelt-wrong-type.tbc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/PNaClTranslator.cpp
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
index ac9698e598e97d757d378a2e47eeb4fb9e13bee0..449332a3cbb6fe596457d6044b986b26426c8e9f 100644
--- a/src/PNaClTranslator.cpp
+++ b/src/PNaClTranslator.cpp
@@ -2037,7 +2037,11 @@ private:
std::string Buffer;
raw_string_ostream StrBuf(Buffer);
StrBuf << "Value index " << Index << " not defined!";
- Fatal(StrBuf.str());
+ Error(StrBuf.str());
+ // Recover and return some value.
+ if (!LocalOperands.empty())
+ return LocalOperands.front();
+ return Context->getGlobalConstantByID(0);
}
};
@@ -2288,6 +2292,16 @@ void FunctionParser::ProcessRecord() {
appendErrorInstruction(Elt->getType());
return;
}
+ if (Ice::typeElementType(VecType) != Elt->getType()) {
+ std::string Buffer;
+ raw_string_ostream StrBuf(Buffer);
+ StrBuf << "Insertelement: Element type "
+ << Ice::typeString(Elt->getType()) << " doesn't match vector type "
+ << Ice::typeString(VecType);
+ Error(StrBuf.str());
+ appendErrorInstruction(Elt->getType());
+ return;
+ }
CurrentNode->appendInst(Ice::InstInsertElement::create(
Func.get(), getNextInstVar(VecType), Vec, Elt, Index));
return;
« no previous file with comments | « no previous file | tests_lit/parse_errs/Inputs/insertelt-wrong-type.tbc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698