http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56153
Bug #: 56153 Summary: False warning about signed and unsigned type in conditional expression Classification: Unclassified Product: gcc Version: 4.6.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: d.dan...@propharma.ch The following code creates a warning "signed and unsigned type in conditional expression" but there is no such comparison: typedef struct { unsigned int num; const char *str; } FooBar; FooBar *foo = (FooBar *)malloc (sizeof (FooBar)); foo->num = 0; foo->str = "Hello World"; fprintf (stdout, "%d", foo != 0 ? foo->num : -1); If instead, the following code gets compiled, no warning is issued: // .. the same as above fprintf (stdout, "%d", foo != 0 ? foo->num : 1);