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

     1  typedef struct
     2  {
     3    short i __attribute__ ((aligned (2),packed));
     4    int f[2] __attribute__ ((aligned (2),packed));
     5  } A;
     6  
     7  f (ap)
     8    A *ap;
     9  {
    10    short i, j = 1;
    11  
    12    i = ap->f[1];
    13    i += ap->f[j];
    14    for (j = 0; j < 2; j++)
    15      i += ap->f[j];
    16  
    17    return i;
    18  }
    19  
    20  main ()
    21  {
    22    A a;
    23    a.f[0] = 100;
    24    a.f[1] = 13;
    25    if (f (&a) != 139)
    26      abort ();
    27    exit (0);
    28  }