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

Unified Diff: tests/language/range_analysis_test.dart

Issue 11779017: Ensure that LowerBound and UpperBound return overflow marker when overflow occurs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/range_analysis_test.dart
diff --git a/tests/language/range_analysis_test.dart b/tests/language/range_analysis_test.dart
index 7aa2f9427f5075c926c2d567ac5981efbf340ce5..8a4a59f724ba42885bbc54e81726e9b1a3e5b26a 100644
--- a/tests/language/range_analysis_test.dart
+++ b/tests/language/range_analysis_test.dart
@@ -3,10 +3,9 @@
// BSD-style license that can be found in the LICENSE file.
// Dart test program for constructors and initializers.
-// Checks that range analysis does not enter infinite loop trying to propagate
+// Check that range analysis does not enter infinite loop trying to propagate
// ranges through dependant phis.
-
-test() {
+bar() {
var sum = 0;
for (var i = 0; i < 10; i++) {
for (var j = i - 1; j >= 0; j--) {
@@ -18,6 +17,27 @@ test() {
return sum;
}
+test1() {
+ for (var i = 0; i < 1000; i++) bar();
+}
+
+// Check that range analysis does not erroneously remove overflow check.
+test2() {
+ var width = 1073741823;
+ print(foo(width - 5000, width - 1));
+ print(foo(width - 5000, width));
+}
+
+foo(n, w) {
+ var x = 0;
+ for (var i = n; i <= w; i++) {
+ Expect.isTrue(i > 0);
+ x = i;
+ }
+ return x;
+}
+
main() {
- for (var i = 0; i < 1000; i++) test();
+ test1();
+ test2();
}
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698