public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/63445] [5 Regression] request: make -Wstrict-overflow avoid a class of false positives
Date: Tue, 07 Oct 2014 16:49:00 -0000	[thread overview]
Message-ID: <bug-63445-4-GzBpbU3bnO@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-63445-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> Found new range for j_9: [i_15 + 1, +INF]
> 
> Visiting statement:
> _6 = j_9 - i_15;
> Found new range for _6: [1, +INF(OVF)]
> 
> i_15 could be negative and thus j_9 - i_15 could well overflow the input
> range at the +INF side.  (i_15 is [-INF, j_5(D) + -1])

Yes, the range is as expected here but...

> I believe we are just better in propagating the ranges here and 4.9
> computed _6 as VARYING (and thus not applying the optimization).

...we actually don't apply any optimization to the code:

Value ranges after VRP:

n_1: [1, +INF]  EQUIVALENCES: { n_7 c_8 n_16 } (3 elements)
_2: [1, +INF]  EQUIVALENCES: { n_7 n_16 } (2 elements)
pretmp_3: ~[0, 0]
i_4(D): VARYING
j_5(D): VARYING
_6: [1, +INF(OVF)]
n_7: [0, +INF]

[...]

  <bb 2>:
  if (i_4(D) < j_5(D))
    goto <bb 3>;
  else
    goto <bb 7>;

  <bb 3>:
  _6 = j_5(D) - i_4(D);
  n_7 = (unsigned int) _6;
  if (_6 != 0)
    goto <bb 4>;
  else
    goto <bb 7>;

The range of n_7 is suboptimal and the test on _6 can be eliminated.


  parent reply	other threads:[~2014-10-07 16:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-02 20:08 [Bug c/63445] New: " jim at meyering dot net
2014-10-07 11:24 ` [Bug tree-optimization/63445] [5 Regression] " rguenth at gcc dot gnu.org
2014-10-07 13:06 ` manu at gcc dot gnu.org
2014-10-07 14:01 ` rguenther at suse dot de
2014-10-07 16:49 ` ebotcazou at gcc dot gnu.org [this message]
2014-10-08 10:51 ` ebotcazou at gcc dot gnu.org
2014-10-09  8:21 ` rguenth at gcc dot gnu.org
2014-10-09  8: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-63445-4-GzBpbU3bnO@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).