This is the mail archive of the
mailing list for the GCC project.
Re: i * i is nonnegative
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: Jeff Law <law at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 19 Mar 2013 17:41:07 +0100 (CET)
- Subject: Re: i * i is nonnegative
- References: <alpine dot DEB dot 2 dot 02 dot 1303191659110 dot 4515 at stedding dot saclay dot inria dot fr> <51489096 dot 4080908 at redhat dot com>
On Tue, 19 Mar 2013, Jeff Law wrote:
On 03/19/2013 10:08 AM, Marc Glisse wrote:
Fine for the trunk. Though I would suggest waiting for http service & web
archives to return before committing.
this patch extends the property that x*x is non-negative, which was
already known for floats, to integers with undefined overflow.
2013-03-19 Marc Glisse <firstname.lastname@example.org>
* fold-const.c (tree_binary_nonnegative_warnv_p) <MULT_EXPR>:
Also handle integers with undefined overflow.
* gcc.dg/pr56355-1.c: New file.
BTW, did you check if VRP creates a non-negative range for this case as well?
It doesn't :-(
It would probably need to be done in extract_range_from_binary_expr since
extract_range_from_binary_expr_1 does not see the expression, maybe after
calling extract_range_from_binary_expr_1, and we would remove the negative
part of the interval it returned.