https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117179
qinzhao at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenther at suse dot de --- Comment #8 from qinzhao at gcc dot gnu.org --- for the reduced testing case, with my work-in-progress 3rd version of the patch + -fdiagnostics-explain-harder: t.c:15:15: warning: array subscript [0, 2] is outside array bounds of ‘const char *[2]’ [-Warray-bounds=] 15 | if (commands[comind] == "b" && | ~~~~~~~~^~~~~~~~ ‘setval_internal_tilde’: events 1-2 4 | if (comind > sizeof(commands)/sizeof(commands[0])) { | ^ | | | (1) t.c:15:24: warning: when the condition is evaluated to true ...... 15 | if (commands[comind] == "b" && | ~~~~~~~~~~~~~~~~ | | | (2) t.c:15:24: warning: out of array bounds here t.c:1:13: note: while referencing ‘commands’ 1 | const char* commands[] = {"a", "b"}; | ^~~~~~~~ looks like a helpful diagnostic.