diff options
Diffstat (limited to 'gcc/testsuite/gcc.apple/shorten.c')
-rw-r--r-- | gcc/testsuite/gcc.apple/shorten.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.apple/shorten.c b/gcc/testsuite/gcc.apple/shorten.c new file mode 100644 index 00000000000..842979b4ed9 --- /dev/null +++ b/gcc/testsuite/gcc.apple/shorten.c @@ -0,0 +1,20 @@ +/* APPLE LOCAL file 64bit shorten warning 3865314 */ +/* { dg-do compile } */ +/* { dg-options "-Wshorten-64-to-32" } */ +/* Radar 3865314 */ + +long long ll; +int i; +char c; + +void bar (int); + +void foo() { + c = i; + c = ll; + i = (int) ll; + i = ll; /* { dg-warning "implicit conversion shortens 64-bit value into a 32-bit value" } */ + i += ll; /* { dg-warning "implicit conversion shortens 64-bit value into a 32-bit value" } */ + i = i ? ll : i;/* { dg-warning "implicit conversion shortens 64-bit value into a 32-bit value" } */ + bar (ll); /* { dg-warning "implicit conversion shortens 64-bit value into a 32-bit value" } */ +} |