Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr81396.c
blob9f4a08d1c2282fe9dca26478b49f5c7f4b77fffd
1 /* PR tree-optimization/81396 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-optimized" } */
5 typedef unsigned long long uint64_t;
7 uint64_t
8 foo (uint64_t word)
10 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG_LONG__ == 8
11 const unsigned char *const ptr = (const unsigned char *) &word;
12 return ((uint64_t) ptr[0]
13 | ((uint64_t) ptr[1] << 8)
14 | ((uint64_t) ptr[2] << (8 * 2))
15 | ((uint64_t) ptr[3] << (8 * 3))
16 | ((uint64_t) ptr[4] << (8 * 4))
17 | ((uint64_t) ptr[5] << (8 * 5))
18 | ((uint64_t) ptr[6] << (8 * 6))
19 | ((uint64_t) ptr[7] << (8 * 7)));
20 #else
21 return word;
22 #endif
25 /* { dg-final { scan-tree-dump "return word_\[0-9]*\\(D\\);" "optimized" } } */