(root)/
gcc-13.2.0/
gcc/
testsuite/
c-c++-common/
Wduplicated-branches-7.c
       1  /* PR c/64279 */
       2  /* { dg-do compile } */
       3  /* { dg-options "-Wduplicated-branches" } */
       4  
       5  struct S
       6  {
       7    int x;
       8  } s;
       9  int a[10];
      10  
      11  #define XMEM(R) ((R).x)
      12  #define XSTR(R) ((R).x)
      13  
      14  void
      15  f (int i)
      16  {
      17    if (i)
      18      XMEM(s) = 1;
      19    else
      20      XSTR(s) = 1;
      21  
      22    if (i) /* { dg-warning "this condition has identical branches" } */
      23      s.x = 1;
      24    else
      25      s.x = 1;
      26  
      27    if (i)
      28      XMEM(s) = 1;
      29    else
      30      s.x = 1;
      31  
      32    if (i)
      33      s.x = 1;
      34    else
      35      XMEM(s) = 1;
      36  }