From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 96A76395A075; Wed, 16 Nov 2022 13:34:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 96A76395A075 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668605649; bh=Xx0k6XEKM4lddV5yealR1N/GxUVdsY8CCLdBmLOK8cs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=gTLx4fW/pzghp4QMg1cwizFMc6cmwrDeZsgMsW7BJWSapEM/E881i7+UkYOiVCtof 1A7qnc99icvAh9gzh9OExrZrBEMEKtt5+QEQQaXd9iTtbBYMwKz0nN7tmwjb9AcJTS b453tCVKB0rQyuS62I9SOI0h8d8jlowHpUP1vlag= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107699] False positive -Warray-bounds, non-existent offset reported by GCC Date: Wed, 16 Nov 2022 13:34:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: everconfirmed bug_status cf_reconfirmed_on cc 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107699 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2022-11-16 CC| |msebor at gcc dot gnu.org, | |rguenth at gcc dot gnu.org --- Comment #1 from Richard Biener --- It diagnoses if (&MEM [(void *)&data + 64B] !=3D __i_32) and the code is confused about the type and the address-taken special allowing taking the address of one after the array. All the second-guessing whats the "array access" performed here (none!) is wrong. If the address is inside or one after the object then it's OK. Here we guess an element size of 12, visible by warning: array subscript 16 is outside array bounds of 'std::array = [1]' but no idea where the [1] comes from. The code might try to match some useful cases but it should give up in a more forgiving way when it gets totally wrong in cases like this.=