https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77696
--- Comment #8 from David Malcolm <dmalcolm at gcc dot gnu.org> --- (In reply to David Malcolm from comment #5) > I brainstormed some ideas on making these kinds of warning easier for > the user to understand. Getting really fancy, we could emit an ASCII art visualization to (hopefully) make the buffer overflow crystal-clear (with an option to disable it): demo.c:6:3: note: buffer overflow [-fdiagnostics-show-buffer-overflow] snprintf of "%s" from: |+---+---+ ... +---+---+|+---+---+ ... +---+---+| || 0| 1| | 9| 10||| 11| 12| | 41| 42|| ||'t'|'h'| |'o'|'n'|||'g'|' '| |'e'|NUL|| |+---+---+ ... +---+---+|+---+---+ ... +---+---+| vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv |<--- ok --->|<-- overflow -->| | | | to 'buf': | | | ++---+---+---+---+---+|+---+---+ ... +---+---+| || 0| 1| 2| 3| 4||5 | 6| | 14| 15|| ||'m'|'s'|'g'|':'|' '|||'t'|'h'| |'o'|'n'|| ++---+---+---+---+---+|+---+---+ ... +---+---+| | | (thus showing the buffer content where it's known, eliding the middle when it goes above 5 elements) The parts on the right-hand side ("overflow" etc) could be colorized in red.