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

Unified Diff: test/cctest/asmjs/test-asm-typer.cc

Issue 2481103002: [wasm] [asm.js] Don't allow bad return types from a global constant (Closed)
Patch Set: Created 4 years, 1 month 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 | « src/asmjs/asm-typer.cc ('k') | test/mjsunit/asm/asm-validation.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/asmjs/test-asm-typer.cc
diff --git a/test/cctest/asmjs/test-asm-typer.cc b/test/cctest/asmjs/test-asm-typer.cc
index 4eaa154a6eabb45fc3b93ebb626177965701796f..0050e88a8b2eded61efd2c25f856aef2e45b6652 100644
--- a/test/cctest/asmjs/test-asm-typer.cc
+++ b/test/cctest/asmjs/test-asm-typer.cc
@@ -2026,4 +2026,31 @@ TEST(B640194) {
}
}
+TEST(B660813) {
+ const char* kTests[] = {
+ "function asm() {\n"
+ " 'use asm';\n"
+ " const i = 0xffffffff;\n"
+ " function f() {\n"
+ " return i;\n"
+ " }\n"
+ "}",
+ "function asm() {\n"
+ " 'use asm';\n"
+ " const i = -(-2147483648);\n"
+ " function f() {\n"
+ " return i;\n"
+ " }\n"
+ "}",
+ };
+ for (size_t ii = 0; ii < arraysize(kTests); ++ii) {
+ if (!ValidationOf(Module(kTests[ii]))
+ ->FailsWithMessage(
+ "Constant in return must be signed, float, or double.")) {
+ std::cerr << "Test:\n" << kTests[ii];
+ CHECK(false);
+ }
+ }
+}
+
} // namespace
« no previous file with comments | « src/asmjs/asm-typer.cc ('k') | test/mjsunit/asm/asm-validation.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698