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

qinzhao at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW

--- Comment #14 from qinzhao at gcc dot gnu.org ---
with my work-in-progress patch, for the creduced small testing case, I got the
following diagnostic when adding -fdiagnostics-explain-harder:
t_115274.c:4:25: warning: ‘strlen’ reading 1 or more bytes from a region of
size 0 [-Wstringop-overread]
    4 | int b(char *d) { return strlen(d); }
      |                         ^~~~~~~~~
  ‘e’: events 1-2
    4 | int b(char *d) { return strlen(d); }
      |                         ~~~~~~~~~
      |                         |
      |                         (2) out of array bounds here
......
    8 |   if (c == 0)
      |      ^
      |      |
      |      (1) when the condition is evaluated to true
In function ‘e’:
cc1: note: source object is likely at address zero

Looks like a helpful diagnostic to the user.

Reply via email to