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

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: 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..5f87897c8f927f548fb1cb0cc62fd4c9bd0a2d63 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,15 @@ void FunctionParser::ProcessRecord() {
appendErrorInstruction(Elt->getType());
return;
}
+ if (Ice::typeElementType(VecType) != Elt->getType()) {
+ std::string Buffer;
+ raw_string_ostream StrBuf(Buffer);
+ StrBuf << "Element type " << Ice::typeString(Elt->getType())
Jim Stichnoth 2015/09/21 21:39:54 May want to use the string "insertelement" in the
Karl 2015/09/21 22:32:46 Done.
+ << " 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