[Bug rtl-optimization/83565] New: RTL combine pass breaks shift result (at least on ia64)
slyfox at inbox dot ru
gcc-bugzilla@gcc.gnu.org
Sat Dec 23 14:40:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83565
Bug ID: 83565
Summary: RTL combine pass breaks shift result (at least on
ia64)
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: slyfox at inbox dot ru
Target Milestone: ---
Created attachment 42959
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42959&action=edit
a.c
Original but was seen as an openssl DES testsuite failure.
Below is a distilled example that yields differetn results
when built as -O0 vs. -O1 built:
#include <stdio.h>
/*
$ gcc -O0 a.c -o a-O0 && ./a-O0 > o0
$ gcc -O1 a.c -o a-O1 && ./a-O1 > o1
$ diff -U0 o0 o1
-off>>: 7fffffff
+off>>: ffffffff
*/
typedef unsigned int u32;
u32 bug (u32 * result) __attribute__((noinline));
u32 bug (u32 * result)
{
// non-static and non-volatile to inhibit constant propagation
volatile u32 ss = 0xFFFFffff;
volatile u32 d = 0xEEEEeeee;
u32 tt = d & 0x00800000;
u32 r = tt << 8;
// rotate
r = (r >> 31)
| (r << 1);
u32 u = r^ss;
u32 off = u >> 1;
// seemingly unrelated but bug-triggering side-effect
*result = tt;
return off;
}
int main() {
u32 l;
u32 off = bug(&l);
printf ("off>>: %08x\n", off);
return 0;
}
More information about the Gcc-bugs
mailing list