Fix ICE in substring-handling building 502.gcc_r (PR 87562)
[official-gcc.git] / gcc / testsuite / c-c++-common / Wduplicated-cond-4.c
blob4fb7e174848f9c69b9c5b8450f44efaac1bf4340
1 /* PR c/64249 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wduplicated-cond" } */
4 /* Test we don't warn if a condition in an if-else-if chain
5 has a side-effect. E.g. __cxxabiv1::__cxa_end_catch ()
6 uses such a construction. */
8 extern int a, bar (void);
10 int
11 fn1 (void)
13 if (a)
14 return 1;
15 else if (bar ())
16 return 2;
17 else if (a)
18 return 3;
19 return 0;
22 int
23 fn2 (int c)
25 if (c < 0)
26 return 1;
27 else if (--c == 0)
28 return 2;
29 else if (c < 0)
30 return 3;
31 return 0;