summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/switch-warn-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/switch-warn-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/switch-warn-2.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/switch-warn-2.c b/gcc/testsuite/gcc.dg/switch-warn-2.c
new file mode 100644
index 00000000000..ab742669163
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/switch-warn-2.c
@@ -0,0 +1,23 @@
+/* This should not warn about the case label being out of range. */
+/* { dg-do run } */
+/* { dg-options "-O0" } */
+
+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);
+}