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: avoid generating casts for bools


On Mon, 3 May 2004 law@redhat.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
jsm@polyomino.org.uk


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