summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/integer-overflow.cpp
diff options
context:
space:
mode:
authorVolodymyr Sapsai <vsapsai@apple.com>2018-03-27 21:29:05 +0000
committerVolodymyr Sapsai <vsapsai@apple.com>2018-03-27 21:29:05 +0000
commitca7902f7d2d7b11c247421b6029e73bdda1b85d7 (patch)
tree7d897d65f33577a281129a658cff8305d18ac2e1 /clang/test/SemaCXX/integer-overflow.cpp
parent7cb26ad2ef0714b010269d92eb5570f6a1b619df (diff)
downloadbcm5719-llvm-ca7902f7d2d7b11c247421b6029e73bdda1b85d7.tar.gz
bcm5719-llvm-ca7902f7d2d7b11c247421b6029e73bdda1b85d7.zip
[Sema] Emit -Winteger-overflow for arguments in function calls, ObjC messages.
rdar://problem/35539384 Reviewers: ahatanak, nicholas, rsmith, jkorous-apple Reviewed By: jkorous-apple Subscribers: cfe-commits, jkorous-apple Differential Revision: https://reviews.llvm.org/D42938 llvm-svn: 328671
Diffstat (limited to 'clang/test/SemaCXX/integer-overflow.cpp')
-rw-r--r--clang/test/SemaCXX/integer-overflow.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/integer-overflow.cpp b/clang/test/SemaCXX/integer-overflow.cpp
index 6abc9561449..956ec157b3f 100644
--- a/clang/test/SemaCXX/integer-overflow.cpp
+++ b/clang/test/SemaCXX/integer-overflow.cpp
@@ -169,3 +169,18 @@ uint64_t check_integer_overflows(int i) { //expected-note {{declared here}}
// expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}}
return ((4608 * 1024 * 1024) + ((uint64_t)(4608 * 1024 * 1024)));
}
+
+void check_integer_overflows_in_function_calls() {
+// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
+ (void)f0(4608 * 1024 * 1024);
+
+// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
+ uint64_t x = f0(4608 * 1024 * 1024);
+
+// expected-warning@+2 {{overflow in expression; result is 536870912 with type 'int'}}
+ uint64_t (*f0_ptr)(uint64_t) = &f0;
+ (void)(*f0_ptr)(4608 * 1024 * 1024);
+
+// expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}}
+ (void)f2(0, f0(4608 * 1024 * 1024));
+}
OpenPOWER on IntegriCloud