]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/pr94873.c
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / pr94873.c
1 /* PR rtl-optimization/94873 */
2 /* { dg-do run { target int128 } } */
3 /* { dg-options "-O -fno-merge-constants -fno-split-wide-types -fno-tree-fre" } */
4
5 __attribute__((noipa)) void
6 foo (const char *p, int q)
7 {
8 if (p[0] != '%' || p[1] != '0' || p[2] != '2' || p[3] != 'x' || p[4] != '\0')
9 __builtin_abort ();
10 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
11 if ((unsigned char) q != 0x95)
12 __builtin_abort ();
13 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
14 if ((unsigned char) q != 0)
15 __builtin_abort ();
16 #endif
17 }
18
19 int
20 main ()
21 {
22 union U { __int128 a; char b[sizeof (__int128)]; };
23 char x = ((union U){ .a = 0xF4409395252B9560ULL}).b[1];
24 for (unsigned i = 0; i < sizeof (x); i++)
25 foo ("%02x", i[(volatile unsigned char *) &x]);
26 return 0;
27 }