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

     1  __extension__ typedef __UINT32_TYPE__ uint32_t;
     2  
     3  struct lock_chain {
     4    uint32_t irq_context: 2,
     5      depth: 6,
     6      base: 24;
     7  };
     8  
     9  __attribute__((noinline, noclone))
    10  struct lock_chain * foo (struct lock_chain *chain)
    11  {
    12    int i;
    13    for (i = 0; i < 100; i++)
    14      {
    15        chain[i+1].base = chain[i].base;
    16      }
    17    return chain;
    18  }
    19  
    20  struct lock_chain1 {
    21    char x;
    22    unsigned short base;
    23  } __attribute__((packed));
    24  
    25  __attribute__((noinline, noclone))
    26  struct lock_chain1 * bar (struct lock_chain1 *chain)
    27  {
    28    int i;
    29    for (i = 0; i < 100; i++)
    30      {
    31        chain[i+1].base = chain[i].base;
    32      }
    33    return chain;
    34  }
    35  
    36  struct lock_chain test [101];
    37  struct lock_chain1 test1 [101];
    38  
    39  int
    40  main ()
    41  {
    42    foo (test);
    43    bar (test1);
    44    return 0;
    45  }