aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/switch-warn-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/switch-warn-2.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/switch-warn-2.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/switch-warn-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/switch-warn-2.c
new file mode 100644
index 000000000..7778b66e0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/switch-warn-2.c
@@ -0,0 +1,26 @@
+/* This should not warn about the case label being out of range. */
+/* { dg-do run } */
+/* { dg-options "-O0" } */
+
+extern void abort (void);
+extern void exit (int);
+
+int
+foo (unsigned int i)
+{
+ switch (i)
+ {
+ case 123456123456ULL: /* { dg-warning "large integer implicitly truncated to unsigned type" } */
+ return 0;
+ default:
+ return 3;
+ }
+}
+
+int
+main (void)
+{
+ if (foo (10) != 3)
+ abort ();
+ exit (0);
+}