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

     1  /* PR middle-end/31448, this used to ICE during expand because
     2     reduce_to_bit_field_precision was not ready to handle constants. */
     3  /* { dg-require-effective-target int32plus } */
     4  
     5  typedef struct _st {
     6      int iIndex : 24;
     7      int iIndex1 : 24;
     8  } st;
     9  st *next;
    10  void g(void)
    11  {
    12      st *next = 0;
    13      int nIndx;
    14      const static int constreg[] = { 0,};
    15      nIndx = 0;
    16      next->iIndex = constreg[nIndx];
    17  }
    18  void f(void)
    19  {
    20      int nIndx;
    21      const static int constreg[] = { 0xFEFEFEFE,};
    22      nIndx = 0;
    23      next->iIndex = constreg[nIndx];
    24      next->iIndex1 = constreg[nIndx];
    25  }
    26  int main(void)
    27  {
    28    st a;
    29    next = &a;
    30    f();
    31    if (next->iIndex != 0xFFFEFEFE)
    32      __builtin_abort ();
    33    if (next->iIndex1 != 0xFFFEFEFE)
    34      __builtin_abort ();
    35    return 0;
    36  }
    37