On 7/9/21 12:16 AM, Richard Biener wrote:
On Thu, Jul 8, 2021 at 8:02 PM Martin Sebor via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:

Hi Ian,

Yesterday's enhancement to -Warray-bounds has exposed a couple of
issues in libgo where the code writes into an invalid constant
address that the warning is designed to flag.

On the assumption that those invalid addresses are deliberate,
the attached patch suppresses these instances by using #pragma
GCC diagnostic but I don't think I'm supposed to commit it (at
least Git won't let me).  To avoid Go bootstrap failures please
either apply the patch or otherwise suppress the warning (e.g.,
by using a volatile pointer temporary).

Btw, I don't think we should diagnose things like

                 *(int*)0x21 = 0x21;

when somebody literally writes that he'll be just annoyed by diagnostics.

Of course the above might be able to use __builtin_trap (); - it looks
like it is placed where control flow should never end, kind of a
__builtin_unreachable (), which means abort () might do as well.

I agree that the literal case isn't interesting.  At the time
the warnings run the distinction between a nonnull literal and
one derived from a null has been lost.  I'm hoping to replace
this with an early pass to detect null pointer arithmetic.

Martin


Richard.

Thanks
Martin

Reply via email to