Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/pr65215-5.c

raw
1 /* PR tree-optimization/65215 */
2
3 __attribute__((noinline, noclone)) unsigned int
4 foo (unsigned char *p)
5 {
6 return ((unsigned int) p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
7 }
8
9 __attribute__((noinline, noclone)) unsigned int
10 bar (unsigned char *p)
11 {
12 return ((unsigned int) p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0];
13 }
14
15 struct S { unsigned int a; unsigned char b[5]; };
16
17 int
18 main ()
19 {
20 struct S s = { 1, { 2, 3, 4, 5, 6 } };
21 if (__CHAR_BIT__ != 8 || sizeof (unsigned int) != 4)
22 return 0;
23 if (foo (&s.b[1]) != 0x03040506U
24 || bar (&s.b[1]) != 0x06050403U)
25 __builtin_abort ();
26 return 0;
27 }