[cfe-dev] Unexpected results from _Bool cast

Chris Lattner clattner at apple.com
Sun Dec 5 09:56:11 PST 2010


On Dec 5, 2010, at 1:04 AM, Dave Keck wrote:

> Hey list,
> 
> The following program outputs '0' when compiled on my system with `clang a.c`:
> 
>    #include <stdio.h>
>    int main(int argc, const char *argv[])
>    {
>        printf("%d\n", (_Bool)((void *)0xCAFEBABE));
>        return 0;
>    }
> 
> Could someone confirm this is a bug? (Section 6.3.1.2 of C99 seems to
> suggest that it is.) I suspect I need to upgrade Xcode/clang/llvm, but
> I thought I'd check before I attempt to download that monstrosity on
> my wee connection.

Yep, that would be a bug to print 0.  It works for me with mainline though,

-Chris



More information about the cfe-dev mailing list