diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:06:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:06:01 +0000 |
commit | 486754660bb926339aefcf012a3f848592babb8b (patch) | |
tree | ecdbc446c9876f4f120f701c243373cd3cb43db3 /test/SemaCXX/integer-overflow.cpp | |
parent | 55e6d896ad333f07bb3b1ba487df214fc268a4ab (diff) |
Notes
Diffstat (limited to 'test/SemaCXX/integer-overflow.cpp')
-rw-r--r-- | test/SemaCXX/integer-overflow.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/SemaCXX/integer-overflow.cpp b/test/SemaCXX/integer-overflow.cpp index 6abc95614496..956ec157b3fa 100644 --- a/test/SemaCXX/integer-overflow.cpp +++ b/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)); +} |