This is the mail archive of the
mailing list for the GCC project.
Re: [Commited] Constant fold (x | 5) != 0
- From: "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 23 Mar 2004 19:50:43 +0000 (UTC)
- Subject: Re: [Commited] Constant fold (x | 5) != 0
- References: <Pine.LNX.email@example.com>
On Tue, 23 Mar 2004, Roger Sayle wrote:
>  The expression "A & B" is nonnegative, if A or B is nonnegative.
>  The expression "A | B" is nonnegative, if A and B are nonnegative.
>  The expression "A | B" is nonzero, if A is nonzero or B is nonzero.
It should be possible to write testcases for these, using the tree-level
warnings that depend on whether something is known to be nonnegative.
f(unsigned short a1, unsigned short a2, unsigned int b)
return ((a1+a2)|5) > b ? 2 : 3;
should no longer warn with -Wsign-compare.
Joseph S. Myers