https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108770
--- Comment #3 from qinzhao at gcc dot gnu.org --- With my patch for new option -fdiagnostics-explain-harder, the output is: t_108770.c: In function ‘init’: t_108770.c:10:13: warning: array subscript 2 is above array bounds of ‘const char *[2]’ [-Warray-bounds=] 10 | while (arr[check_idx(i)] != 0) { | ~~~^~~~~~~~~~~~~~ ‘init’: events 1-2 3 | if (i > 1) | ^ | | | (1) when the condition is evaluated to true ...... 10 | while (arr[check_idx(i)] != 0) { | ~~~~~~~~~~~~~~~~~ | | | (2) out of array bounds here t_108770.c:7:13: note: while referencing ‘arr’ 7 | const char *arr[] = {"A", 0}; | ^~~ this looks like a nice improvement to the diagnostic.