This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Improvements to tree_expr_nonnegative_p


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
useful.

-- 
Joseph S. Myers
jsm28@cam.ac.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]