aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Sema/integer-overflow.c
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2017-05-17 23:56:54 +0000
committerNick Lewycky <nicholas@mxc.ca>2017-05-17 23:56:54 +0000
commit9add1594d2cd5250bf6ea57bcfdb3dce676ba736 (patch)
treee58268d783d63d72c73008b5f680b5c991cc6946 /clang/test/Sema/integer-overflow.c
parent0cf5b2f88a299e17ca80e562f2fe9f35c7375ba3 (diff)
downloadllvm-9add1594d2cd5250bf6ea57bcfdb3dce676ba736.zip
llvm-9add1594d2cd5250bf6ea57bcfdb3dce676ba736.tar.gz
llvm-9add1594d2cd5250bf6ea57bcfdb3dce676ba736.tar.bz2
The constant expression evaluator should examine function arguments for non-constexpr function calls unless the EvalInfo says to stop.
llvm-svn: 303317
Diffstat (limited to 'clang/test/Sema/integer-overflow.c')
-rw-r--r--clang/test/Sema/integer-overflow.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Sema/integer-overflow.c b/clang/test/Sema/integer-overflow.c
index 62ee33e..c2b6ba2 100644
--- a/clang/test/Sema/integer-overflow.c
+++ b/clang/test/Sema/integer-overflow.c
@@ -151,6 +151,14 @@ uint64_t check_integer_overflows(int i) {
uint64_t *b;
uint64_t b2 = b[4608 * 1024 * 1024] + 1;
+// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
+ f0(4608 * 1024 * 1024);
+ f0(4608ul * 1024 * 1024);
+// expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
+ f1(4608 * 1024 * 1024, 4608 * 1024 * 1024);
+// expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
+ f2(4608 * 1024 * 1024, 4608 * 1024 * 1024);
+
// expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
int j1 = i ? (4608 * 1024 * 1024) : (4608 * 1024 * 1024);