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

     1  typedef unsigned int u32;
     2  
     3  static const u32 deadfish = 0xdeadf155;
     4  
     5  static const u32 cfb_tab8_be[] = {
     6      0x00000000,0x000000ff,0x0000ff00,0x0000ffff,
     7      0x00ff0000,0x00ff00ff,0x00ffff00,0x00ffffff,
     8      0xff000000,0xff0000ff,0xff00ff00,0xff00ffff,
     9      0xffff0000,0xffff00ff,0xffffff00,0xffffffff
    10  };
    11  
    12  static const u32 cfb_tab8_le[] = {
    13      0x00000000,0xff000000,0x00ff0000,0xffff0000,
    14      0x0000ff00,0xff00ff00,0x00ffff00,0xffffff00,
    15      0x000000ff,0xff0000ff,0x00ff00ff,0xffff00ff,
    16      0x0000ffff,0xff00ffff,0x00ffffff,0xffffffff
    17  };
    18  
    19  static const u32 cfb_tab16_be[] = {
    20      0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff
    21  };
    22  
    23  static const u32 cfb_tab16_le[] = {
    24      0x00000000, 0xffff0000, 0x0000ffff, 0xffffffff
    25  };
    26  
    27  static const u32 cfb_tab32[] = {
    28   0x00000000, 0xffffffff
    29  };
    30  
    31  
    32  
    33  
    34  
    35  
    36  const u32 *xxx(int bpp)
    37  {
    38   const u32 *tab;
    39  
    40  if (0) return &deadfish;
    41  
    42   switch (bpp) {
    43   case 8:
    44    tab = cfb_tab8_be;
    45    break;
    46   case 16:
    47    tab = cfb_tab16_be;
    48    break;
    49   case 32:
    50   default:
    51    tab = cfb_tab32;
    52    break;
    53   }
    54  
    55   return tab;
    56  }
    57  
    58  int main(void)
    59  {
    60    const u32 *a = xxx(8);
    61    int b = a[0];
    62    if (b != cfb_tab8_be[0])
    63      __builtin_abort ();
    64    return 0;
    65  }