Fix broken MinGW build of gcc.c
[official-gcc.git] / gcc / testsuite / c-c++-common / Wduplicated-branches-2.c
blob8669dd6a6291c4d4572288f926d75d3b5ca939a7
1 /* PR c/64279 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wduplicated-branches -O2" } */
5 void
6 f (int *p)
8 if (*p > 0)
10 if (x == 0) /* { dg-error "undeclared|not declared" } */
11 *p = 5;
12 else
13 *p = 6;
17 void
18 f2 (int *p)
20 if (*p > 0)
22 if (*p > 2)
23 *p = x; /* { dg-error "undeclared|not declared" } */
24 else
25 *p = 6;
29 void
30 f3 (int *p)
32 if (*p > 0)
34 if (*p > 2)
35 *p = 8;
36 else
37 *p = x; /* { dg-error "undeclared|not declared" } */
41 void
42 f4 (int *p)
44 if (*p > 0)
46 if (x == 0) /* { dg-error "undeclared|not declared" } */
47 *p = 5;
48 else
49 *p = 6;
51 else
53 if (x == 0) /* { dg-error "not declared" "" { target c++ } } */
54 *p = 7;
55 else
56 *p = 6;
60 void
61 f5 (int *p)
63 if (*p > 0)
65 if (*p > 2)
66 *p = x; /* { dg-error "undeclared|not declared" } */
67 else
68 *p = 6;
70 else
72 if (x == 0) /* { dg-error "not declared" "" { target c++ } } */
73 *p = 5;
74 else
75 *p = 6;
79 void
80 f6 (int *p)
82 if (*p > 0)
84 if (*p > 2)
85 *p = 8;
86 else
87 *p = x; /* { dg-error "undeclared|not declared" } */
89 else
91 if (x == 0) /* { dg-error "not declared" "" { target c++ } } */
92 *p = 5;
93 else
94 *p = 6;
98 void
99 f7 (int i)
101 if (i > 5)
102 ({ x++; }); /* { dg-error "undeclared|not declared" } */
103 else
104 ({ i++; });
107 void
108 f8 (int i)
110 if (i > 5)
111 ({ i++; });
112 else
113 ({ x++; }); /* { dg-error "undeclared|not declared" } */