This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Improvements to tree_expr_nonnegative_p
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 8 Jun 2003 20:17:57 +0100 (BST)
- Subject: Re: [PATCH] Improvements to tree_expr_nonnegative_p
- References: <Pine.LNX.firstname.lastname@example.org>
On Sun, 8 Jun 2003, Roger Sayle wrote:
> The answer is that zero_extend(x) + zero_extend(y) is always non-negative
> if both x any y are unsigned, and both are atleast two bits shorter than
> the result-type. This is unrelated to overflow, and the "signed vs.
> unsigned comparison" warning is now avoided independently of flag_wrapv.
You can do both - avoid warning based on these range calculations (which
gets some cases independently of flag_wrapv), and avoid warning in other
cases based on signed overflow being undefined (e.g., unsigned short *
unsigned short). Both cases (and the corresponding case for product of
signed values based on ranges, e.g. unsigned char * unsigned short) are
Joseph S. Myers