[Bug tree-optimization/92539] [8/9/10/11 Regression] -Warray-bounds false positive with -O3 (loop unroll?)

law at redhat dot com gcc-bugzilla@gcc.gnu.org
Sun Feb 14 13:59:52 GMT 2021


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

--- Comment #6 from Jeffrey A. Law <law at redhat dot com> ---
I wonder if we're looking at this the wrong way.

We have several blocks with this kind of structure:

  <bb 8> [local count: 30530247]:
  if (last_12 != &MEM <const char> [(void *)"aa" + 3B])
    goto <bb 9>; [54.59%]
  else
    goto <bb 12>; [45.41%]


The key point being that the RHS of the conditional is a bogus pointer. 
Nothing can ever be equal to that pointer.  So we should be able to determine
the result of the conditional in all those blocks.

I suspect that alone is sufficient to make the false positive go away.


More information about the Gcc-bugs mailing list