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 tree-optimization/60183] [4.7/4.8/4.9 Regression] phiprop creates invalid code
Date: Fri, 14 Feb 2014 09:22:00 -0000	[thread overview]
Message-ID: <bug-60183-4-bnKnPxAeMK@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-60183-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60183

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Updated testcase that segfaults for me, no -fsanitize=address is then needed to
trigger it.  Works with -O0 or -O? -fno-tree-phiprop:

unsigned char c[0x300001] = { 1 };
int j = 2;

static void
foo (unsigned long *x, unsigned char *y)
{
  int i;
  unsigned long w = x[0];
  for (i = 0; i < j; i++)
    {
      w += *y;
      y += 0x100000;
      w += *y;
      y += 0x100000;
    }
  x[1] = w;
}

__attribute__ ((noinline, noclone)) void
bar (unsigned long *x)
{
  foo (x, c);
}

int
main ()
{
  unsigned long a[2] = { 0, -1UL };
  asm volatile (""::"r" (c):"memory");
  c[0] = 0;
  bar (a);
  if (a[1] != 0)
    __builtin_abort ();
  return 0;
}

Perhaps phiprop is confused by the &MEM[(void *)y_5 + 2097152B] and thinks that
because of the MEM_REF in there it is safe to dereference it?


  parent reply	other threads:[~2014-02-14  9:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-60183-4@http.gcc.gnu.org/bugzilla/>
2014-02-13 19:22 ` jakub at gcc dot gnu.org
2014-02-14  9:18 ` rguenth at gcc dot gnu.org
2014-02-14  9:22 ` jakub at gcc dot gnu.org [this message]
2014-02-14  9:28 ` rguenth at gcc dot gnu.org
2014-02-14 12:58 ` rguenth at gcc dot gnu.org
2014-02-15  9:55 ` rguenth at gcc dot gnu.org
2014-02-25 10:47 ` [Bug tree-optimization/60183] [4.7/4.8 " rguenth at gcc dot gnu.org
2014-02-25 10:48 ` [Bug tree-optimization/60183] [4.7 " rguenth at gcc dot gnu.org
2014-03-17 14:39 ` rguenth at gcc dot gnu.org
2014-03-17 14:40 ` rguenth 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-60183-4-bnKnPxAeMK@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).