------- Comment #8 from michael dot malone at tait dot co dot nz 2009-02-24 00:40 ------- #ifdef UINT #include <stdint.h> #define TYPE uint16_t #else #define TYPE unsigned short int #endif
#define VALUE 0xFF int main(void); int main() { TYPE variable_a = ~VALUE; TYPE variable_b = VALUE; TYPE result; #ifdef ASSIGN TYPE tmp = ~variable_a; result = (variable_b == tmp); #else result = (variable_b == (TYPE) ~variable_a); #endif return 0; } Further to John's input, here is a sample program which shows up why this bug is interesting. When one uses a typedef'd type, the promoted comparison warning is displayed. When one does not, it isn't! This is not the case for gcc-4.2.3 -both variants compile without warnings. The compile commands I used were: gcc gcc_bug.c -W -Wall -o bug and gcc gcc_bug.c -W -Wall -DUINT -o bug -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38341