From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F2F753952011; Thu, 17 Mar 2022 10:49:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F2F753952011 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/99578] [11/12 Regression] gcc-11 -Warray-bounds or -Wstringop-overread warning when accessing a pointer from integer literal Date: Thu, 17 Mar 2022 10:49:01 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Mar 2022 10:49:03 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99578 --- Comment #33 from Jonathan Wakely --- (In reply to Martin Sebor from comment #31) > As I mentioned in comment #25 and elsewhere, I envisioned that code would > annotate these hardwired addresses somehow, ideally using an attribute li= ke > addr or the Keil compiler's at (see below), or until one is added, using a > workaround like your absolute_pointer(). I realize it means work, but I > believe with the attribute the gain in type safety would make it worthwhi= le. > Is that something the kernel developers could be trained to start using?= =20 > (In full disclosure, I don't expect to have the cycles to work on the > attribute anytime soon.) Whether or not it's reasonable to expect working code to be transitioned to= a new feature, in the absence of such a feature (and no likelihood of it appearing any time soon) we should not be giving warnings for this code. The idea that it's zero-cost or zero-risk to go around sprinkling casts in working code that passes all its tests is foolish. Every cast added to sile= nce a false positive warning has a risk of introducing a new problem and hiding= a real bug in future.=