(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
fold-cstring.c
       1  /* { dg-do run } */
       2  /* { dg-options "-O" } */
       3  
       4  /* The following are testcases for native_interpret_int,
       5     native_interpret_complex and native_interpret_vector decoding
       6     pieces of a string constant encoded by native_encode_string.  */
       7  
       8  extern void abort (void);
       9  
      10  /* We should fold all reads from xconstant and eliminate it, removing
      11     the reference to blah which cannot be resolved at link time.  */
      12  extern int blah;
      13  
      14  static const struct {
      15      int *y;
      16      const char x[32] __attribute__((aligned(32)));
      17  } xconstant = { &blah, "01234567899876543210123456789000" };
      18  
      19  typedef int v4si __attribute__((vector_size(16)));
      20  
      21  int main()
      22  {
      23    if (sizeof (int) != 4)
      24      return 0;
      25    if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
      26      {
      27        if (*(int *)&xconstant.x[4] != 0x34353637)
      28  	abort ();
      29        if ((*(v4si *)&xconstant.x[16])[1] != 0x31323334)
      30  	abort ();
      31        if (__imag (*(_Complex int *)&xconstant.x[8]) != 0x37363534)
      32  	abort ();
      33      }
      34    else if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
      35      {
      36        if (*(int *)&xconstant.x[4] != 0x37363534)
      37  	abort ();
      38        if ((*(v4si *)&xconstant.x[16])[1] != 0x34333231)
      39  	abort ();
      40        if (__imag (*(_Complex int *)&xconstant.x[8]) != 0x34353637)
      41  	abort ();
      42      }
      43    return 0;
      44  }