(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
torture/
parm-coalesce.c
       1  /* { dg-do run } */
       2  
       3  #include <stdlib.h>
       4  
       5  /* Make sure we don't coalesce both incoming parms, one whose incoming
       6     value is unused, to the same location, so as to overwrite one of
       7     them with the incoming value of the other.  */
       8  
       9  int __attribute__((noinline, noclone))
      10  foo (int i, int j)
      11  {
      12    j = i; /* The incoming value for J is unused.  */
      13    i = 2;
      14    if (j)
      15      j++;
      16    j += i + 1;
      17    return j;
      18  }
      19  
      20  /* Same as foo, but with swapped parameters.  */
      21  int __attribute__((noinline, noclone))
      22  bar (int j, int i)
      23  {
      24    j = i; /* The incoming value for J is unused.  */
      25    i = 2;
      26    if (j)
      27      j++;
      28    j += i + 1;
      29    return j;
      30  }
      31  
      32  int
      33  main (void)
      34  {
      35    if (foo (0, 1) != 3)
      36      abort ();
      37    if (bar (1, 0) != 3)
      38      abort ();
      39    return 0;
      40  }