aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Sema/integer-overflow.c
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2017-04-29 09:33:46 +0000
committerNick Lewycky <nicholas@mxc.ca>2017-04-29 09:33:46 +0000
commite7d6fbdfb766f7d20aca405a7136ce8f7e04e705 (patch)
tree9d2966a9d9fa9ecd57381addb646da0de2dd8977 /clang/test/Sema/integer-overflow.c
parent8fb5a14cadd55ba865b802fbe77fdd60253b9bf3 (diff)
downloadllvm-e7d6fbdfb766f7d20aca405a7136ce8f7e04e705.zip
llvm-e7d6fbdfb766f7d20aca405a7136ce8f7e04e705.tar.gz
llvm-e7d6fbdfb766f7d20aca405a7136ce8f7e04e705.tar.bz2
Remove Sema::CheckForIntOverflow, and instead check all full-expressions.
CheckForIntOverflow used to implement a whitelist of top-level expressions to send to the constant expression evaluator, which handled many more expressions than the CheckForIntOverflow whitelist did. llvm-svn: 301742
Diffstat (limited to 'clang/test/Sema/integer-overflow.c')
-rw-r--r--clang/test/Sema/integer-overflow.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/test/Sema/integer-overflow.c b/clang/test/Sema/integer-overflow.c
index 44c2629..62ee33e 100644
--- a/clang/test/Sema/integer-overflow.c
+++ b/clang/test/Sema/integer-overflow.c
@@ -152,7 +152,13 @@ uint64_t check_integer_overflows(int i) {
uint64_t b2 = b[4608 * 1024 * 1024] + 1;
// expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
- (void)((i ? (4608 * 1024 * 1024) : (4608 * 1024 * 1024)) + 1);
+ int j1 = i ? (4608 * 1024 * 1024) : (4608 * 1024 * 1024);
+
+// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
+ int j2 = -(4608 * 1024 * 1024);
+
+// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
+ uint64_t j3 = b[4608 * 1024 * 1024];
// expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
return ((4608 * 1024 * 1024) + ((uint64_t)(4608 * 1024 * 1024)));