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

--- Comment #5 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
Created attachment 43259
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43259&action=edit
proposed UNTESTED patch

(In reply to Jakub Jelinek from comment #4)
> I don't think we want to be adding new cases where -Warray-bounds will warn
> at this point, this warning has very high false positive rate and it is
> simply too late in the release cycle for that IMNSHO.  I'd retarget all
> similar PRs for GCC9.

Hmmm... this may be easy pickings though.

It looks like before the regression we had an ARRAY_REF we could diagnose:

  D.2720_5 = "12345678"[1073741824];

But now this is represented as:

  _1 = MEM[(const char *)"12345678" + 1073741824B];

I think we can just allow check_array_bounds() to handle MEM_REF's and
everything should just work.

The attached untested patch fixes the PR.  However, if you think this is not
worth pursuing, I can drop this and retarget this bug to GCC 9.

Your call Jakub.

Reply via email to