(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
guality/
restrict.c
       1  /* debuginfo tests for combinations of const, volatile, restrict pointers. */
       2  /* { dg-do run } */
       3  /* { dg-options "-std=c99 -gdwarf-3" } */
       4  
       5  int *ip __attribute__((used));
       6  const int *cip __attribute__((used));
       7  int * restrict irp __attribute__((used));
       8  int * const icp __attribute__((used));
       9  const int * restrict cirp __attribute__((used));
      10  int * const restrict icrp __attribute__((used));
      11  const int * const restrict cicrp __attribute__((used));
      12  
      13  int * const volatile restrict cvirp __attribute__((used));
      14  const volatile int * restrict pcvir __attribute__((used));
      15  
      16  static __attribute__((noclone, noinline)) void *
      17  cpy (void * restrict s1, const void * restrict s2, unsigned int n)
      18  {
      19    char *t1 = s1;
      20    const char *t2 = s2;
      21    while(n-- > 0)
      22      *t1++ = *t2++;
      23    return s1;
      24  }
      25  
      26  int
      27  main (int argc, char **argv)
      28  {
      29    void *foo = 0;
      30    if (argc > 16)
      31      foo = cpy (argv[0], argv[1], argc);
      32  
      33    return foo != 0;
      34  }
      35  
      36  /* { dg-final { gdb-test 30 "type:ip" "int *" } } */
      37  /* { dg-final { gdb-test 30 "type:cip" "const int *" } } */
      38  /* { dg-final { gdb-test 30 "type:irp" "int * restrict" } } */
      39  /* { dg-final { gdb-test 30 "type:icp" "int * const" } } */
      40  /* { dg-final { gdb-test 30 "type:cirp" "const int * restrict" } } */
      41  /* { dg-final { gdb-test 30 "type:icrp" "int * const restrict" } } */
      42  /* { dg-final { gdb-test 30 "type:cicrp" "const int * const restrict" } } */
      43  
      44  /* { dg-final { gdb-test 30 "type:cvirp" "int * const volatile restrict" } } */
      45  /* { dg-final { gdb-test 30 "type:pcvir" "const volatile int * restrict" } } */
      46  
      47  /* { dg-final { gdb-test 30 "type:main" "int (int, char **)" } } */
      48  /* { dg-final { gdb-test 30 "type:cpy" "void *(void * restrict, const void * restrict, unsigned int)" } } */