(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
pr19633-1.c
       1  /* { dg-do run } */
       2  /* { dg-options "-O2" } */
       3  
       4  extern void abort (void);
       5  extern void link_error (void);
       6  
       7  struct S
       8  {
       9    int w, x, y, z;
      10  };
      11  
      12  struct T
      13  {
      14    int r;
      15    struct S s;
      16  };
      17  
      18  struct S bar (struct S x, struct S *y)
      19  {
      20    y->w = 4;
      21    return *y;
      22  }
      23  
      24  void
      25  foo (int a, struct T b)
      26  {
      27    struct S x;
      28    struct S *c = &x;
      29    if (a)
      30      c = &b.s;
      31    b.s.w = 3;
      32    /* This call should be marked as clobbering 'x' and 'b'.  */
      33    *c = bar (*c, c);
      34    if (b.s.w == 3)
      35      abort ();
      36  }
      37  
      38  float Y;
      39  
      40  struct S bar1 (struct S x, struct S y)
      41  {
      42    Y = 4;
      43    return x;
      44  }
      45  
      46  void
      47  foo1 (int a, struct T b)
      48  {
      49    struct S x;
      50    struct S *c = &x;
      51    float z, *k = &z;
      52    if (a)
      53      c = &b.s;
      54    b.s.w = 3;
      55    /* This call should NOT be marked as clobbering 'x' and 'b'.  */
      56    x = bar1 (*c, *c);
      57    if (b.s.w != 3)
      58      link_error ();
      59  }
      60  
      61  int main ()
      62  {
      63    struct T b;
      64    foo (3, b);
      65    foo1 (3, b);
      66    return 0;
      67  }