https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70477
Petr Vandrovec <petr at vandrovec dot name> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |petr at vandrovec dot name --- Comment #7 from Petr Vandrovec <petr at vandrovec dot name> --- Would it be possible to special-case parameter for _Static_assert, as whole purpose of _Static_assert is to have constant value that is non-zero? We have in our code base code that ends up calling _Static_assert() with really complicated constant expression. When regular gcc is used, code compiles fine with all optimization levels, as gcc recognizes there are complicated macros involved, and backs off. When ccache is used, it preprocesses source in separate step, and gcc will complain about tautological compare inside _Static_assert :-( Would it be possible to either suppress warning when used as parameter for _Static_assert, or remove tautological-compare warnings if -fpreprocessed is passed to the compiler, as macro heuristics are subverted by doing preprocessing in separate step? Example (our code is more complicated, this is simplest example I came up with): $ cat test.c #define A &a int a; void test(void) { _Static_assert(&a == A, "&a must be A"); } $ gcc -c -Wall -Werror test.c $ gcc -c -Wall -Werror test.c -no-integrated-cpp x.c: In function 'test': x.c.:5:22: error: self-comparison always evaluates to true [-Werror=tautological-compare] _Static_assert(&a == A, "&a must be A"); cc1: all warnings being treated as errors It happens with 8.2.0, as well as with 6.4.0. $ gcc --version gcc (Debian 8.2.0-6) 8.2.0