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

     1  /* PR middle-end/29272 */
     2  
     3  extern void abort (void);
     4  
     5  struct S { struct S *s; } s;
     6  struct T { struct T *t; } t;
     7  
     8  static inline void
     9  foo (void *s)
    10  {
    11    struct T *p = s;
    12    __builtin_memcpy (&p->t, &t.t, sizeof (t.t));
    13  }
    14  
    15  void *
    16  __attribute__((noinline))
    17  bar (void *p, struct S *q)
    18  {
    19    q->s = &s;
    20    foo (p);
    21    return q->s;
    22  }
    23  
    24  int
    25  main (void)
    26  {
    27    t.t = &t;
    28    if (bar (&s, &s) != (void *) &t)
    29      abort ();
    30    return 0;
    31  }