public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rakdver at kam dot mff dot cuni dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/40087] [4.3/4.4/4.5 Regression] Number of iterations analysis wrong
Date: Fri, 15 May 2009 15:45:00 -0000	[thread overview]
Message-ID: <20090515154449.17400.qmail@sourceware.org> (raw)
In-Reply-To: <bug-40087-17694@http.gcc.gnu.org/bugzilla/>



------- Comment #8 from rakdver at kam dot mff dot cuni dot cz  2009-05-15 15:44 -------
Subject: Re:  [4.3/4.4/4.5 Regression] Number of iterations analysis wrong

> > > It is number of iteration analysis that gets it wrong (I suppose it might get
> > > confused by the two exits of the loop?).
> > 
> > Sort of; # of iterations analysis assumes that pointers never wrap, and uses
> > this assumption to derive a wrong number of iterations for the first exit
> > (which is not taken).  We had a similar problem before (PR 25985), but I
> > somehow persuaded myself that this cannot happen with pointers.
> 
> Ah - it indeed cannot happen, but you need to assume that the offsets
> in POINTER_PLUS_EXPRs are signed (even though they are unsigned as
> they are of type sizetype).

that is not the problem.  The problem is that # of iterations analysis
has a look at the first test, of form [x,+,4] == [x + 28, +, -4],
observes that the variables do not wrap, and concludes that the loop
is not infinite.  So far OK, but next we infer that this means that
the exit is taken, i.e., that 28 % 8 = 0, and the things go down for
there.  I fixed this error before, but special-cased the pointer ivs
in a strike of wishful thinking.


-- 


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


  parent reply	other threads:[~2009-05-15 15:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-10  1:39 [Bug c/40087] New: Bad assembly for -O2 markus at cs dot wisc dot edu
2009-05-10  1:41 ` [Bug c/40087] " markus at cs dot wisc dot edu
2009-05-10  1:44 ` markus at cs dot wisc dot edu
2009-05-10  1:48 ` markus at cs dot wisc dot edu
2009-05-10  9:42 ` [Bug tree-optimization/40087] " rguenth at gcc dot gnu dot org
2009-05-10  9:53 ` [Bug tree-optimization/40087] [4.3/4.4/4.5 Regression] Number of iterations analysis wrong rguenth at gcc dot gnu dot org
2009-05-10 12:59 ` rakdver at gcc dot gnu dot org
2009-05-15  0:34 ` rakdver at gcc dot gnu dot org
2009-05-15  8:44 ` rguenther at suse dot de
2009-05-15 15:45 ` rakdver at kam dot mff dot cuni dot cz [this message]
2009-05-20  0:34 ` rakdver at gcc dot gnu dot org
2009-05-20  9:21 ` [Bug tree-optimization/40087] [4.3/4.4 " rguenth at gcc dot gnu dot org
2009-05-21 11:37 ` rguenth at gcc dot gnu dot org
2009-05-22 20:44 ` rakdver at gcc dot gnu dot org
2009-05-23  9:15 ` [Bug tree-optimization/40087] [4.3 " rguenth at gcc dot gnu dot org
2009-06-15 10:10 ` cnstar9988 at gmail dot com
2009-06-15 14:24 ` mikpe at it dot uu dot se
2009-06-17 15:12 ` rguenth at gcc dot gnu dot org
2009-06-17 19:46 ` rguenth at gcc dot gnu dot org
2009-06-17 19:46 ` rguenth at gcc dot gnu dot org
2009-06-17 19:49 ` 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=20090515154449.17400.qmail@sourceware.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).