[cfe-dev] Crash with incorrect _Bool->_Bool conversion

Chris Lattner clattner at apple.com
Tue Jan 29 23:02:04 PST 2008


On Jan 29, 2008, at 7:47 PM, Eli Friedman wrote:

> So that I don't lose track, posting this testcase here:
>
> _Bool x; int a() {if (x);}
>
> Essentially, EmitScalarConversion is assuming that since the source
> and destination types are the same, no conversion is needed, which is
> wrong in this case.  (Although maybe loading a boolean variable should
> immediately truncate it to i1; not sure what the right fix is here.)

You're right, we always want bool to be i1 when in a register (even  
though it can be i8 or i32 in memory), so truncating it is the right  
fix.  I've committed a patch, thanks!

-Chris



More information about the cfe-dev mailing list