On 7/21/21 10:41 AM, Kyrylo Tkachov wrote:
-----Original Message-----
From: Gcc-patches <gcc-patches-
bounces+kyrylo.tkachov=arm....@gcc.gnu.org> On Behalf Of Martin Sebor
via Gcc-patches
Sent: 10 July 2021 00:11
To: gcc-patches <gcc-patches@gcc.gnu.org>; Christophe Lyon
<christophe.l...@linaro.org>
Subject: [PATCH libatomic/arm] avoid warning on constant addresses (PR
101379)
The attached tweak avoids the new -Warray-bounds instances when
building libatomic for arm. Christophe confirms it resolves
the problem (thank you!)
As we have discussed, the main goal of this class of warnings
is to detect accesses at addresses derived from null pointers
(e.g., to struct members or array elements at a nonzero offset).
Diagnosing accesses at hardcoded addresses is incidental because
at the stage they are detected the two are not distinguishable
from each another.
I'm planning (hoping) to implement detection of invalid pointer
arithmetic involving null for GCC 12, so this patch is a stopgap
solution to unblock the arm libatomic build without compromising
the warning. Once the new detection is in place these workarounds
can be removed or replaced with something more appropriate (e.g.,
declaring the objects at the hardwired addresses with an attribute
like AVR's address or io; that would enable bounds checking at
those addresses as well).
Let's get this patch in to unbreak bootstrap while the discussion on how to
avoid these workarounds continues...
So ok.
I just pushed it in r12-2438.
Martin
Thanks,
Kyrill
Martin