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

--- Comment #5 from qinzhao at gcc dot gnu.org ---
with my current patch to PR109071, adding -fdiagnostics-explain-harder,  with
an additional option -fno-tree-dominator-opts, the diagnostic becomes:

t_85788.c:5:3: warning: ‘__builtin___memset_chk’ forming offset [64008,
134180872] is out of the bounds [0, 64008] of object ‘m’ with type ‘j’
[-Warray-bounds=]
    5 |   __builtin___memset_chk(k, b, l, f);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ‘n’: events 1-2
    5 |   __builtin___memset_chk(k, b, l, f);
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |   |
      |   (2) t_85788.c:20:1: warning: out of array bounds here
......
   14 |   for (; c; c = e)
      |          ^
      |          |
      |          (1) t_85788.c:20:1: warning: when the condition is evaluated
to true
t_85788.c: In function ‘n’:
t_85788.c:21:3: note: ‘m’ declared here

I think that the above more details will help the user to locate the issue in
their code.

I will improve my current patch to record the code duplication during
"tree-dominator-opts" after "thread" in order to remove the
"-fno-tree-dominator-opts"

Reply via email to