https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101272
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[12 Regression] error: |[12 Regression] error: |‘nonnull’ argument |‘nonnull’ argument |‘message’ compared to NULL |‘message’ compared to NULL |[-Werror=nonnull-compare] |[-Werror=nonnull-compare] |since |since r12-1805 Keywords| |diagnostic --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- The warning is valid and expected. It started to be issued with r12-1805. Prior to that, the parentheses around the inequality expression suppressed it, like so: $ cat t.C && cc1plus.r12-1804 -quiet -Wall -Werror -o/dev/null t.C __attribute__ ((nonnull)) void f (int *p) { p == 0 ? __builtin_abort () : (void)0; } __attribute__ ((nonnull)) void g (int *p) { (p == 0) ? __builtin_abort () : (void)0; } t.C: In function ‘void f(int*)’: t.C:2:21: error: ‘nonnull’ argument ‘p’ compared to NULL [-Werror=nonnull-compare] 2 | f (int *p) { p == 0 ? __builtin_abort () : (void)0; } | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1plus.r12-1804: all warnings being treated as errors