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

     1  /* { dg-xfail-if "ABI specifies bitfields cannot exceed 32 bits" { mcore-*-* } } */
     2  struct tmp
     3  {
     4    long long int pad : 12;
     5    long long int field : 52;
     6  };
     7  
     8  struct tmp2
     9  {
    10    long long int field : 52;
    11    long long int pad : 12;
    12  };
    13  
    14  struct tmp
    15  sub (struct tmp tmp)
    16  {
    17    tmp.field |= 0x0008765412345678LL;
    18    return tmp;
    19  }
    20  
    21  struct tmp2
    22  sub2 (struct tmp2 tmp2)
    23  {
    24    tmp2.field |= 0x0008765412345678LL;
    25    return tmp2;
    26  }
    27  
    28  main()
    29  {
    30    struct tmp tmp = {0x123, 0xFFF000FFF000FLL};
    31    struct tmp2 tmp2 = {0xFFF000FFF000FLL, 0x123};
    32  
    33    tmp = sub (tmp);
    34    tmp2 = sub2 (tmp2);
    35  
    36    if (tmp.pad != 0x123 || tmp.field != 0xFFFFFF541FFF567FLL)
    37      abort ();
    38    if (tmp2.pad != 0x123 || tmp2.field != 0xFFFFFF541FFF567FLL)
    39      abort ();
    40    exit (0);
    41  }