public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/101031] [12 Regression] wrong code at -O2 on x86_64-linux-gnu
Date: Fri, 11 Jun 2021 13:52:45 +0000	[thread overview]
Message-ID: <bug-101031-4-qphd8B4klj@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101031-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101031

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Simpler IL:

int a;
char b, e;
static char *c = &b;
static long d;
void f(void);
void __attribute__((noipa)) h() {
  int g = 0;
  for (; g < 2; ++g) {
    d = *c;
    *c = 1;
    b = 0;
  }
  f();
}
void __attribute__((noipa)) f() {
  if (d++)
    c = &e;
  for (; a;)
    ;
}
int main() {
  h();
  if (b != 0)
    __builtin_abort ();
  return 0;
}

we end up with

void h ()
{
  char * c.0_14;
  char _24;
  long int _25;

  <bb 2> [local count: 357878152]:
  c.0_14 = c;
  *c.0_14 = 1;
  b = 0;
  _24 = *c.0_14;
  _25 = (long int) _24;
  d = _25;
  *c.0_14 = 1;
  f (); [tail call]
  return;

  parent reply	other threads:[~2021-06-11 13:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11 13:28 [Bug tree-optimization/101031] New: " qrzhang at gatech dot edu
2021-06-11 13:29 ` [Bug tree-optimization/101031] " qrzhang at gatech dot edu
2021-06-11 13:31 ` [Bug tree-optimization/101031] [12 Regression] " jakub at gcc dot gnu.org
2021-06-11 13:48 ` rguenth at gcc dot gnu.org
2021-06-11 13:52 ` rguenth at gcc dot gnu.org [this message]
2021-06-14  7:35 ` rguenth at gcc dot gnu.org
2021-06-14  9:14 ` cvs-commit at gcc dot gnu.org
2021-06-14 10:21 ` 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-101031-4-qphd8B4klj@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).