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/62006] Bad code generation with -O3 (possibly due to -ftree-partial-pre)
Date: Mon, 04 Aug 2014 12:00:00 -0000	[thread overview]
Message-ID: <bug-62006-4-fvOgPGJoLb@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-62006-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
It looks ok what PRE does (it's not really a partial partial redundancy but
a full redundndancy).

The bug also reproduces with -O2 -ftree-partial-pre.  Disabling loop
optimizations and cddce2 hides the bug.

With PPRE enabled CDDCE2 removes the stores to D.46421.diff (again I see
nothing wrong with doing that).

Btw, this all happens in _M_range_initialize.  (-fno-strict-aliasing fixes
the bug as well).

Note that I see stores as OffPtrBase to automatic objects:

-  MEM[(struct OffPtrBase *)&D.46421].diff = _70;

and loads from OffPtr via this:

   _16 = &MEM[(struct OffPtr *)this_4(D)].D.43564;

or remaining stores:

   MEM[(struct OffPtrBase *)this_4(D) + 16B].diff = iftmp.15_41;

I also see:

   _74 = (sizetype) _47;
   iftmp.10_75 = &D.46429.D.43564 + _74;
   __last.3_77 = (long int) iftmp.10_75;
   __first.4_78 = (long int) &D.46430.D.43564;
   _79 = __last.3_77 - __first.4_78;

which effectively subtracts two unrelated addresses of automatic objects
(boooo - undefined behavior!)

I think the testcase is simply bogus.  Can you explain what the "fancy"
pointers
do?  Disabling points-to analysis also "fixes" the testcase.

Note that with points-to analysis you cannot reach any other object
with offsetting the address of an object.


  parent reply	other threads:[~2014-08-04 12:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-04 10:40 [Bug c++/62006] New: " tkoeppe at google dot com
2014-08-04 10:55 ` [Bug tree-optimization/62006] " redi at gcc dot gnu.org
2014-08-04 11:24 ` rguenth at gcc dot gnu.org
2014-08-04 12:00 ` rguenth at gcc dot gnu.org [this message]
2014-08-04 12:05 ` tkoeppe at google dot com
2014-08-04 12:13 ` rguenth at gcc dot gnu.org
2014-08-04 13:20 ` rguenth at gcc dot gnu.org
2014-08-04 13:23 ` rguenth at gcc dot gnu.org
2014-08-04 13:31 ` tkoeppe at google dot com
2014-08-04 13:44 ` rguenther at suse dot de
2014-08-05 13:06 ` 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-62006-4-fvOgPGJoLb@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).