This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/66444] New: [5/6 Regression] Miscompilation of Xen since r211078
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 06 Jun 2015 19:39:40 +0000
- Subject: [Bug rtl-optimization/66444] New: [5/6 Regression] Miscompilation of Xen since r211078
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66444
Bug ID: 66444
Summary: [5/6 Regression] Miscompilation of Xen since r211078
Product: gcc
Version: 5.1.1
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
CC: vmakarov at gcc dot gnu.org, vries at gcc dot gnu.org
Target Milestone: ---
void foo (unsigned long);
int bar (unsigned long);
unsigned long a, c, d, f, g;
volatile void *b;
int e;
struct S { unsigned long p, q, r; void *v; };
void fn2 (struct S *x);
__attribute__((noinline, noclone)) void *
fn1 (struct S *x)
{
unsigned long y = x->q;
unsigned long z = a;
do
{
if ((x->q + 2 & 1UL << 63 - 10) <= 2)
return (void *) 0;
}
while (y = z != x->q);
return x->v ? x->v : (void *) 0;
}
int
baz (void)
{
foo (f);
struct S *x = (struct S *) 0xe000000000UL;
x += bar (f);
fn1 (x);
fn2 (x);
return 0;
}
reduced from Xen is miscompiled at -O2 starting with r211078 on x86_64-linux.
Still in *.optimized dump we have:
_6 = bar (f.0_4);
_7 = (long unsigned int) _6;
_8 = _7 * 32;
x_9 = 962072674304B + _8;
fn1 (x_9);
fn2 (x_9);
(note the same value, constant + 32 * result of bar) is passed to both fn1 and
fn2.
But starting with *.reload we get:
movabsq $962072674304, %r8
salq $5, %rax
leaq (%r8,%rax), %rdi
call fn1
movq %r8, %rdi
call fn2
which is wrong, it passes just the constant, without the added 32 * bar (), to
the second function.