This is the mail archive of the
mailing list for the GCC project.
Re: avoid generating casts for bools
- From: "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- To: law at redhat dot com
- Cc: Dan Nicolaescu <dann at godzilla dot ics dot uci dot edu>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 3 May 2004 19:04:31 +0000 (UTC)
- Subject: Re: avoid generating casts for bools
- References: <200405031814.i43IE5fS009934@speedy.slc.redhat.com>
On Mon, 3 May 2004 email@example.com wrote:
> Thus, if the compiler is claiming the test is always true, then something
> quite bad has happened.
The last time this problem happened (and the bogus warning was quite
wrongly marked as expected in the test for a long time), the comparison
being warned about was one that was constructed by the compiler rather
than in the source code: (_Bool)(u ^ 3) was converted to (_Bool)(u != 3)
and then (u != 3) was always true because u is _Bool. Such warnings
should only occur for actual comparisons in the source code, not any that
may be constructed by fold or other code in the compiler.
Joseph S. Myers