public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/66444] New: [5/6 Regression] Miscompilation of Xen since r211078
Date: Sat, 06 Jun 2015 19:39:00 -0000	[thread overview]
Message-ID: <bug-66444-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2015-06-06 19:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-06 19:39 jakub at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-66444-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).