https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77696

--- Comment #9 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to David Malcolm from comment #8)
> (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

Here's another version of the same UI idea, for the same diagnostic,
which tries to show the string data (in the name of readability; I
think this one is better than the above):

demo.c:6:3: note: buffer overflow...
  snprintf of "%s" from:
            |+-------------+|+---------------------------++---+|
            ||    0 - 10   |||          11  - 41         || 42||
            ||"this is lon"|||"g enough to cause trouble"||NUL||
            |+-------------+|+---------------------------++---+|
            vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
            |<---   ok  --->|<--           overflow         -->|
            |               |                                  |
  to 'buf':
  |         |               |
  ++-------+|+-------------+|
  || 0 - 4 |||   5 - 15    ||
  ||"msg: "|||"this is lon"||
  ++-------+|+-------------+|

Reply via email to