PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / Wparentheses-12.c
blob7832415f1ed706a8ea1631eeba6270bb83ace7ce
1 /* PR c/70436 */
2 /* { dg-options "-Wparentheses" } */
4 int a, b, c;
5 void bar (void);
6 void baz (void);
8 void
9 foo (void)
11 int i, j;
13 if (a) /* { dg-warning "ambiguous" } */
14 for (;;)
15 if (b)
16 bar ();
17 else
18 baz ();
20 if (a) /* { dg-warning "ambiguous" } */
21 while (1)
22 if (b)
23 bar ();
24 else
25 baz ();
27 if (a) /* { dg-warning "ambiguous" } */
28 while (1)
29 for (;;)
30 if (b)
31 bar ();
32 else
33 baz ();
35 if (a) /* { dg-warning "ambiguous" } */
36 while (1)
37 while (1)
38 if (b)
39 bar ();
40 else
41 baz ();
43 if (a) /* { dg-warning "ambiguous" } */
44 for (i = 0; i < 10; i++)
45 for (j = 0; j < 10; j++)
46 if (b)
47 bar ();
48 else
49 baz ();
51 if (a)
52 for (i = 0; i < 10; i++)
53 if (b) /* { dg-warning "ambiguous" } */
54 for (j = 0; j < 10; j++)
55 if (c)
56 bar ();
57 else
58 baz ();
60 if (a) /* { dg-warning "ambiguous" } */
61 for (i = 0; i < 10; i++)
62 if (b)
63 for (j = 0; j < 10; j++)
64 if (c)
65 bar ();
66 else
67 baz ();
68 else
69 bar ();
71 if (a) /* { dg-warning "ambiguous" } */
72 for (;;)
73 if (b)
74 while (1)
75 if (a)
76 bar ();
77 else
78 baz ();
79 else
80 bar ();
82 if (a) /* { dg-warning "ambiguous" } */
83 for (;;)
84 if (b)
85 while (1)
87 if (a) { bar (); } else { baz (); }
89 else
90 bar ();
92 if (a)
93 for (;;)
94 if (b)
95 bar ();
96 else
97 baz ();
98 else bar ();
100 if (a)
101 while (1)
102 if (b)
103 bar ();
104 else
105 baz ();
106 else bar ();
108 if (a)
109 for (;;)
111 if (b)
112 bar ();
113 else
114 baz ();
117 if (a)
119 for (;;)
120 if (b)
121 bar ();
123 else baz ();
125 if (a)
127 if (b) bar (); else baz ();
128 while (b);
130 if (a)
132 if (b) bar ();
133 while (b);
134 else baz ();