public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/66444] New: [5/6 Regression] Miscompilation of Xen since r211078
@ 2015-06-06 19:39 jakub at gcc dot gnu.org
  2015-06-06 19:40 ` [Bug rtl-optimization/66444] " jakub at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-06 19:39 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-06-08 17:25 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-06 19:39 [Bug rtl-optimization/66444] New: [5/6 Regression] Miscompilation of Xen since r211078 jakub at gcc dot gnu.org
2015-06-06 19:40 ` [Bug rtl-optimization/66444] " jakub at gcc dot gnu.org
2015-06-07 22:03 ` vries at gcc dot gnu.org
2015-06-07 22:09 ` vries at gcc dot gnu.org
2015-06-08  6:42 ` jakub at gcc dot gnu.org
2015-06-08  8:31 ` vries at gcc dot gnu.org
2015-06-08  8:34 ` vries at gcc dot gnu.org
2015-06-08  8:36 ` jakub at gcc dot gnu.org
2015-06-08  9:41 ` vries at gcc dot gnu.org
2015-06-08  9:44 ` jakub at gcc dot gnu.org
2015-06-08 12:05 ` vries at gcc dot gnu.org
2015-06-08 17:00 ` vries at gcc dot gnu.org
2015-06-08 17:09 ` vries at gcc dot gnu.org
2015-06-08 17:11 ` vries at gcc dot gnu.org
2015-06-08 17:25 ` vries at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).