public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/49234] [4.5/4.6/4.7/4.8 Regression] -Wstrict-overflow gives obviously unwarranted warning
Date: Thu, 28 Feb 2013 20:41:00 -0000	[thread overview]
Message-ID: <bug-49234-4-Lh9yRCIuop@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-49234-4@http.gcc.gnu.org/bugzilla/>


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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #9 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2013-02-28 20:40:55 UTC ---
(In reply to comment #3)
> We hit:
> 163724    rguenth       /* Similarly, if the new maximum is smaller or larger
> than
> 163724    rguenth        the previous one, go all the way to +INF.  */
> 163724    rguenth       if (cmp_max < 0 || cmp_max > 0)
> 163724    rguenth       {
> 163724    rguenth         if (!needs_overflow_infinity (TREE_TYPE
> (vr_result.max))
> 163724    rguenth             || !vrp_var_may_overflow (lhs, phi))
> 163724    rguenth           vr_result.max = TYPE_MAX_VALUE (TREE_TYPE
> (vr_result.max));
> 163724    rguenth         else if (supports_overflow_infinity (TREE_TYPE
> (vr_result.max)))
> 163724    rguenth           vr_result.max =
> 163724    rguenth               positive_overflow_infinity (TREE_TYPE
> (vr_result.max));
> 163724    rguenth       }
> 

(In reply to comment #8)
> 
> Does this seem like an approach worth exploring (this silences the warning), or
> does anyone have a better suggestion?

Isn't the problem that vrp_var_may_overflow returns true even though 'state'
cannot overflow? Jakub says:

> As the IV (i) might overflow, vrp_var_may_overflow returns true.
> In particular, chrec is SCEV_NOT_KNOWN.  Thus it just in case sets
> vr_result.max to +INF(OVF) and later on we warn about it.
> Before hitting this code, vr_result contains the right range [0, 2], but it
> doesn't know it can safely use that.

Couldn't be possible to detect this by the fact that 'state' does not depend on
anything variable?

Also, in such a case, the algorithm cannot iterate more than the number of phi
nodes in the loop (if I understand the VRP correctly, which I most likely
don't).

But I looked around and I honestly don't know how to implement this idea.

In any case, your patch would need to adjust the code for the minimum also, no?
Because the same behaviour can be triggered just by using negative numbers to
trigger a negative overflow infinity.


  parent reply	other threads:[~2013-02-28 20:41 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-30 17:14 [Bug c/49234] New: " jim at meyering dot net
2011-05-30 20:45 ` [Bug tree-optimization/49234] " rguenth at gcc dot gnu.org
2011-05-31  8:44 ` [Bug tree-optimization/49234] [4.4/4.5/4.7/4.7 Regression] " jakub at gcc dot gnu.org
2011-05-31  9:06 ` jakub at gcc dot gnu.org
2011-08-01 14:04 ` rguenth at gcc dot gnu.org
2012-03-13 15:10 ` [Bug tree-optimization/49234] [4.5/4.7/4.8/4.7/4.8 " jakub at gcc dot gnu.org
2012-07-02 11:37 ` rguenth at gcc dot gnu.org
2013-02-28 13:51 ` aldyh at gcc dot gnu.org
2013-02-28 15:49 ` aldyh at gcc dot gnu.org
2013-02-28 16:01 ` [Bug tree-optimization/49234] [4.5/4.6/4.7/4.8 " aldyh at gcc dot gnu.org
2013-02-28 20:41 ` manu at gcc dot gnu.org [this message]
2013-03-01 11:46 ` rguenth at gcc dot gnu.org
2013-03-01 14:53 ` ian at airs dot com
2013-03-01 19:18 ` aldyh at redhat dot com
2013-03-01 19:23 ` ian at airs dot com
2013-03-01 19:34 ` aldyh at redhat dot com
2013-03-04  9:58 ` rguenther at suse dot de
2013-03-05 18:01 ` aldyh at gcc dot gnu.org
2013-03-06  8:56 ` [Bug tree-optimization/49234] [4.6/4.7/4.8 " rguenth at gcc dot gnu.org
2013-03-06 16:12 ` aldyh at gcc dot gnu.org
2013-03-06 16:19 ` ian at airs dot com
2013-03-06 16:28 ` aldyh at gcc dot gnu.org
2013-03-07  8:37 ` rguenther at suse dot de
2013-04-12  8:40 ` [Bug tree-optimization/49234] [4.6/4.7/4.8/4.9 " rguenth at gcc dot gnu.org
2013-04-12 15:18 ` [Bug tree-optimization/49234] [4.7/4.8/4.9 " jakub at gcc dot gnu.org
2014-06-12 13:48 ` [Bug tree-optimization/49234] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org
2014-12-19 13:32 ` [Bug tree-optimization/49234] [4.8/4.9/5 " jakub at gcc dot gnu.org
2015-02-27 19:14 ` aldyh at gcc dot gnu.org
2015-03-02  9:18 ` [Bug tree-optimization/49234] [4.8/4.9 " rguenth at gcc dot gnu.org
2015-06-23  8:25 ` rguenth at gcc dot gnu.org
2015-06-26 20:00 ` [Bug tree-optimization/49234] [4.9 " jakub at gcc dot gnu.org
2015-06-26 20:31 ` jakub 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-49234-4-Lh9yRCIuop@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).