https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70477
Bug ID: 70477 Summary: -Wtautological-compare too aggressive? Product: gcc Version: 6.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: ktkachov at gcc dot gnu.org Target Milestone: --- I'm trying to perform an aarch64-none-linux-gnu bootstrap with -save-temps in the BOOT_CFLAGS but I'm getting a -Wtautological-compare failure when compiling c-family/c-pragma.c: gcc/c-family/c-pragma.c:415:64: warning: self-comparison always evaluates to false [-Wtautological-compare] if (BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ For aarch64 these are defined as: #define BYTES_BIG_ENDIAN (TARGET_BIG_END != 0) #define WORDS_BIG_ENDIAN (BYTES_BIG_ENDIAN) I think this can be reproduced also as: int var; #define A var #define B var int foo (int a, int b) { if (A == B) return a; else return b; } gcc -Wtautological-compare -c warn.c warn.c: In function 'foo': warn.c:8:9: warning: self-comparison always evaluates to true [-Wtautological-compare] if (A == B) ^~ Should we be warning on these things if they come from a macro expansion?