aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/smtCheckerTests/loops/for_1_fail.sol
diff options
context:
space:
mode:
Diffstat (limited to 'test/libsolidity/smtCheckerTests/loops/for_1_fail.sol')
-rw-r--r--test/libsolidity/smtCheckerTests/loops/for_1_fail.sol17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/libsolidity/smtCheckerTests/loops/for_1_fail.sol b/test/libsolidity/smtCheckerTests/loops/for_1_fail.sol
new file mode 100644
index 00000000..3858403a
--- /dev/null
+++ b/test/libsolidity/smtCheckerTests/loops/for_1_fail.sol
@@ -0,0 +1,17 @@
+pragma experimental SMTChecker;
+
+contract C
+{
+ function f(uint x) public pure {
+ require(x < 100);
+ for(uint i = 0; i < 10; ++i) {
+ // Overflows due to resetting x.
+ x = x + 1;
+ }
+ assert(x < 14);
+ }
+}
+// ----
+// Warning: (176-181): Overflow (resulting value larger than 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) happens here
+// Warning: (172-181): Overflow (resulting value larger than 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) happens here
+// Warning: (189-203): Assertion violation happens here