https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65215
Bug ID: 65215 Summary: [5 Regression] Bswap load miscompilation Product: gcc Version: 5.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: tree-optimization Assignee: jakub at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Starting with r210843, following testcase is miscompiled on big-endian e.g. at -O2: static inline unsigned int foo (unsigned int x) { return (x >> 24) | ((x >> 8) & 0xFF00) | ((x << 8) & 0xFF0000) | (x << 24); } __attribute__((noinline, noclone)) unsigned int bar (unsigned long *x) { return foo (*x); } int main () { unsigned long l = foo (0xdeadbeefU) | 0xfeedbea800000000ULL; if (bar (&l) != 0xdeadbeefU) __builtin_abort (); return 0; }