On 01/30/2018 03:11 PM, Aldy Hernandez wrote:
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.]
Let me first say that I have no concern with adopting this
patch for GCC 8 (and older) and deferring more comprehensive
solutions for the remaining regressions until GCC 9.
With that said, as we discussed last week in IRC, the patch
I submitted for one of these regressions, bug 83776, also
happens to fix one of the two test cases submitted for this
bug:
https://gcc.gnu.org/ml/gcc-patches/2018-01/msg02144.html
I put the patch together because it's a P2 bug and has a Target
Milestone set to 6.5. I took that to mean that it's expected
to be fixed in 8.1 in addition to 7.x and 6.x, but in light of
Jakub's reservations and Ady's question above I'm not sure my
understanding is correct, or if it is, that there necessarily
is consensus to fix them in GCC 8.
I also spent some time over the weekend extending my patch to
handle the additional test case from comment #2 on bug 84047.
That one is also due to the same underlying root cause. I'm
close to done with it but I had to set it aside to handle
a bug in my own code that was reported yesterday.
I mention this because I too would find it helpful if it were
made clear whether these regressions are expected to be fixed
in GCC 8, so we can focus on the right bugs and avoid
duplicating effort. If we want to fix all the reported
-Warray-bounds regressions in GCC 8 then I'll finish my patch
in progress and post it as a followup.
Martin
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?