[PR tree-optimization/84047] missing -Warray-bounds on an out-of-bounds index
Aldy Hernandez
aldyh@redhat.com
Tue Jan 30 22:43:00 GMT 2018
Hi!
[Note: Jakub has mentioned that missing -Warray-bounds regressions
should be punted to GCC 9. I think this particular one is easy
pickings, but if this and/or the rest of the -Warray-bounds regressions
should be marked as GCC 9 material, please let me know so we can adjust
all relevant PRs.]
This is a -Warray-bounds regression that happens because the IL now has
an MEM_REF instead on ARRAY_REF.
Previously 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 patch fixes both regressions mentioned in the PR.
Tested on x86-64 Linux.
OK?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: curr.patch
Type: text/x-patch
Size: 1881 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180130/4d5b4db6/attachment.bin>
More information about the Gcc-patches
mailing list