aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/Wduplicated-branches-4.c
blob: 79af549386636d55187c322eade7c82e7fb86dc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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};
}