From ca7902f7d2d7b11c247421b6029e73bdda1b85d7 Mon Sep 17 00:00:00 2001 From: Volodymyr Sapsai Date: Tue, 27 Mar 2018 21:29:05 +0000 Subject: [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 --- clang/test/Sema/integer-overflow.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'clang/test/Sema/integer-overflow.c') diff --git a/clang/test/Sema/integer-overflow.c b/clang/test/Sema/integer-overflow.c index 44c2629ebf7..d66ce7ff164 100644 --- a/clang/test/Sema/integer-overflow.c +++ b/clang/test/Sema/integer-overflow.c @@ -158,6 +158,21 @@ uint64_t check_integer_overflows(int i) { 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)); +} + struct s { unsigned x; unsigned y; -- cgit v1.2.3