public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/23326] New: [4.0 Regression] Wrong code from forwprop
Date: Thu, 11 Aug 2005 15:20:00 -0000	[thread overview]
Message-ID: <20050811152012.23326.rguenth@gcc.gnu.org> (raw)

The following testcase reduced from Kopete is miscompiled at -O2

struct Bar { bool is() const; int status() const; };

void foobar(void);
void foobar2(void);

void Foo(const Bar& x, const Bar& y)
{
  const bool wasOffline = !x.is();
  const bool isOffline = !y.is();
  if (wasOffline || y.status() == 10)
    foobar();
  if (wasOffline != isOffline)
    foobar2();
}

.t23.mergephi:
<bb 0>:
  D.1589_3 = is (x_2);
  wasOffline_4 = !D.1589_3;
  D.1590_6 = is (y_5);
  isOffline_7 = !D.1590_6;
  if (wasOffline_4) goto <L1>; else goto <L0>;

<L0>:;
  D.1596_10 = status (y_5);
  if (D.1596_10 == 10) goto <L1>; else goto <L5>;

<L1>:;
  foobar ();

<L5>:;
  if (wasOffline_4 != isOffline_7) goto <L6>; else goto <L7>;

<L6>:;
  foobar2 ();

<L7>:;
  return;

.t24.forwprop:
<bb 0>:
  D.1589_3 = is (x_2);
  D.1590_6 = is (y_5);
  isOffline_7 = !D.1590_6;
  if (D.1589_3 == 0) goto <L1>; else goto <L0>;

<L0>:;
  D.1596_10 = status (y_5);
  if (D.1596_10 == 10) goto <L1>; else goto <L5>;

<L1>:;
  foobar ();

<L5>:;
  if (D.1589_3 != 0) goto <L6>; else goto <L7>;

<L6>:;
  foobar2 ();

<L7>:;
  return;

note that the comparison preceding foobar2() is hosed now,
we even don't use isOffline or D.1590 anymore.

-- 
           Summary: [4.0 Regression] Wrong code from forwprop
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: critical
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,matz at suse dot de


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


             reply	other threads:[~2005-08-11 15:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-11 15:20 rguenth at gcc dot gnu dot org [this message]
2005-08-11 15:21 ` [Bug tree-optimization/23326] " rguenth at gcc dot gnu dot org
2005-08-11 15:29 ` pinskia at gcc dot gnu dot org
2005-08-11 15:51 ` pinskia at gcc dot gnu dot org
2005-08-11 16:03 ` pinskia at gcc dot gnu dot org
2005-08-11 17:43 ` rguenth at tat dot physik dot uni-tuebingen dot de
2005-08-11 17:45 ` pinskia at physics dot uc dot edu
2005-08-11 18:05 ` belyshev at depni dot sinp dot msu dot ru
2005-08-12 10:57 ` rguenth at gcc dot gnu dot org
2005-08-22 12:18 ` pinskia at gcc dot gnu dot org
2005-09-01 15:11 ` matz at suse dot de
2005-09-01 15:18 ` rguenth at gcc dot gnu dot org
2005-09-03 19:55 ` rguenth at gcc dot gnu dot org
2005-09-03 19:55 ` cvs-commit at gcc dot gnu dot 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=20050811152012.23326.rguenth@gcc.gnu.org \
    --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).