(root)/
gcc-13.2.0/
gcc/
testsuite/
c-c++-common/
Wduplicated-cond-4.c
       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.  */
       7  
       8  extern int a, bar (void);
       9  
      10  int
      11  fn1 (void)
      12  {
      13    if (a)
      14      return 1;
      15    else if (bar ())
      16      return 2;
      17    else if (a)
      18      return 3;
      19    return 0;
      20  }
      21  
      22  int
      23  fn2 (int c)
      24  {
      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;
      32  }