diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-01-24 22:11:45 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-01-24 22:11:45 +0000 |
commit | e735ff93e828154eb588020a7087b3cf772bdbb2 (patch) | |
tree | 593d4d8573d66484e5e760f2ed4085895e070e29 /clang/test/Sema | |
parent | 858bf6eda59aa22ea2bc244182c3c469d041501c (diff) | |
download | bcm5719-llvm-e735ff93e828154eb588020a7087b3cf772bdbb2.tar.gz bcm5719-llvm-e735ff93e828154eb588020a7087b3cf772bdbb2.zip |
Patch to check for integer overflow. It has been
commented on and approved by Richard Smith.
llvm-svn: 173377
Diffstat (limited to 'clang/test/Sema')
-rw-r--r-- | clang/test/Sema/switch-1.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/test/Sema/switch-1.c b/clang/test/Sema/switch-1.c index e029bc9ffbf..bcf30a8d500 100644 --- a/clang/test/Sema/switch-1.c +++ b/clang/test/Sema/switch-1.c @@ -4,12 +4,12 @@ int f(int i) { switch (i) { - case 2147483647 + 2: // expected-note {{value 2147483649 is outside the range of representable values of type 'int'}} \ - // expected-warning {{overflow in case constant expression results in value -2147483647}} + case 2147483647 + 2: // expected-warning {{overflow in case constant expression results in value -2147483647 of type 'int'}} return 1; - case 9223372036854775807L * 4 : // expected-note {{value 36893488147419103228 is outside the range of representable values of type 'long'}} \ - // expected-warning {{overflow in case constant expression results in value -4}} + case 9223372036854775807L * 4: // expected-warning {{overflow in case constant expression results in value -4 of type 'long'}} return 2; + case (123456 *789012) + 1: // expected-warning {{overflow in case constant expression results in value -1375982336 of type 'int'}} + return 3; case 2147483647: return 0; } |