https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110402
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- We warn about: ``` struct m { float *v; int t; }; _Bool chk1(struct m *m, int key) { return &m->v[key]; } ``` ``` <source>: In function 'chk1': <source>:4:5: warning: the comparison will always evaluate as 'true' for the pointer operand in 'm->v + (sizetype)((long unsigned int)key * 4)' must not be NULL [-Waddress] 4 | return &m->v[key]; | ^~~~~~ ``` The reason why the others in your testcase is not being warned about is more about the shape of the ?: and/or the comma operator getting in the way of moving the implict `!=0` into the `?:`.