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 middle-end/26198]  New: Unfolded comparison after cfg_cleanup
Date: Thu, 09 Feb 2006 15:41:00 -0000	[thread overview]
Message-ID: <bug-26198-10053@http.gcc.gnu.org/bugzilla/> (raw)

struct A
{
  int* x[2];
  A() { for (int** p=x; p<x+2; ++p) *p = 0; }
};

struct B
{
  char c;
  A a0, a1, a2, a3, *p;

  B() {}
  B(const B& b) : c(), a0(b.a0), p(b.p) {}
  ~B() { delete p; }
};

inline void foo(const B& b) { new B(b); }

void bar()
{
  foo(B());
  foo(B());
}

After cfg_cleanup after loop header copying we end up with unfolded

  &D.2114.a0D.2019.xD.1986[2] > &D.2114.a0D.2019.xD.1986[0]

because in fold_binary where we handle this kind of stuff we have

              if (!offset0 || !offset1
                  || TREE_TYPE (offset0) == TREE_TYPE (offset1))
                {
...

and unfortunately the constants 2 and 0 have distinct types:

(gdb) call debug_tree(offset0)
 <integer_cst 0x4026e888 type <integer_type 0x402474ac> constant invariant 8>
(gdb) call debug_tree(offset1)
 <integer_cst 0x4018d180 type <integer_type 0x4019f000 unsigned int> constant
invariant 0>


-- 
           Summary: Unfolded comparison after cfg_cleanup
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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


             reply	other threads:[~2006-02-09 15:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-09 15:41 rguenth at gcc dot gnu dot org [this message]
2006-02-09 15:43 ` [Bug middle-end/26198] " pinskia at gcc dot gnu dot org
2006-06-19 20:10 ` rguenth at gcc dot gnu dot org
2006-10-26  9:53 ` rguenth at gcc dot gnu dot org
2007-03-05 17:07 ` rguenth at gcc dot gnu dot org
2007-10-11 11:57 ` rguenth at gcc dot gnu dot org
2007-10-11 12:11 ` rguenth at gcc dot gnu dot org
2007-10-12  8:42 ` rguenth at gcc dot gnu dot org
2007-10-12  8:42 ` rguenth 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=bug-26198-10053@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).