[tree-ssa] Why are bools cast to int in conditionals?

Joseph S. Myers jsm@polyomino.org.uk
Thu Apr 22 09:13:00 GMT 2004


On Wed, 21 Apr 2004, Dan Nicolaescu wrote:

>   > Here, the usual arithmetic conversions are applied to the operands of !=,
>   > which includes the integer promotions, which promote _Bool to int.
> 
> Is _Bool different from other types in this respect? short, chars and
> enums don't seem to get the same treatment. 

Perhaps some optimization is allowing INTEGER_TYPE but not BOOLEAN_TYPE.  
Various optimizations of operations on promoted types are presently in 
build_binary_op and shorten_compare.

-- 
Joseph S. Myers
jsm@polyomino.org.uk



More information about the Gcc mailing list