aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/Wduplicated-branches-4.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/c-c++-common/Wduplicated-branches-4.c')
-rw-r--r--gcc/testsuite/c-c++-common/Wduplicated-branches-4.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/Wduplicated-branches-4.c b/gcc/testsuite/c-c++-common/Wduplicated-branches-4.c
new file mode 100644
index 0000000..79af549
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wduplicated-branches-4.c
@@ -0,0 +1,35 @@
+/* PR c/64279 */
+/* { dg-do compile } */
+/* { dg-options "-Wduplicated-branches" } */
+
+extern int *g;
+extern const int *q;
+
+void
+f (int i)
+{
+ int j;
+
+ if (i == 0)
+ for (j = 0; j < 10; j++)
+ ++*g;
+ else
+ for (j = 0; j < 10; j++)
+ ++*g;
+
+ if (i == 1)
+ {
+ int i = 10;
+ *g = i;
+ }
+ else
+ {
+ int i = 10;
+ *g = i;
+ }
+
+ if (i == 3)
+ q = (const int []){1};
+ else
+ q = (const int []){1};
+}