modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/restrict-1.c (about)

     1  /*  PR rtl-optimization/16536
     2      Origin:  Jeremy Denise      <jeremy.denise@libertysurf.fr>
     3      Reduced: Wolfgang Bangerth  <bangerth@dealii.org>
     4               Volker Reichelt    <reichelt@igpm.rwth-aachen.de>  */
     5  /* { dg-options "-fgnu89-inline" } */
     6  
     7  extern void abort ();
     8  
     9  typedef struct
    10  {
    11    int i, dummy;
    12  } A;
    13  
    14  inline A foo (const A* p, const A* q)
    15  {
    16    return (A){p->i+q->i};
    17  }
    18  
    19  void bar (A* __restrict__ p)
    20  {
    21    *p=foo(p,p);
    22    if (p->i!=2)
    23      abort();
    24  }
    25  
    26  int main ()
    27  {
    28    A a={1};
    29    bar(&a);
    30    return 0;
    31  }