On 3/20/21 10:48 AM, Jeff Law via Gcc-patches wrote:
On 3/18/2021 4:18 PM, Martin Sebor via Gcc-patches wrote:
Ping:
https://gcc.gnu.org/pipermail/gcc-patches/2021-January/564483.html
The review of this patch digressed into a design discussion of a new,
more capable implementation of -Wstrict-aliasing, but the proposed
patch turning just this one instance of -Warray-bounds into
-Wstrict-aliasing and making it subject to -fstrict-aliasing wasn't
decided. PR 98503 was raised by someone working with the kernel
which uses -fno-strict-aliasing, and so to them the warning isn't
useful. But since the warning does find potential bugs when strict
aliasing is in effect, I'd still like to consider this patch for
GCC 11 so that the kernel (and other such projects) doesn't have
to deal with the false positives.
If/when we add a new, dedicated solution for -Wstrict-aliasing I'll
move this instance from gimple-array-bounds.cc there.
I'm still not comfortable with the bleeding of strict aliasing bits into
the gimple array-bounds checking bits. I think that needs to be fixed
in a cleaner manner before this can go forward.
I can't really think of any other way to resolve PR 98503 for GCC
11 than something like this. I suppose I could make the existing
-Warra-bounds conditional on -fstrict-aliasing (without actually
emitting -Wstrict-aliasing). That way the kernel would be able to
disable it without giving up the aspects of the warning that are
relevant to them. Would that be acceptable to you? If not, what
would be?
Martin