From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2204839450E5; Mon, 19 Apr 2021 15:39:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2204839450E5 From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/100137] [10/11 Regression] -Warray-bounds false positive on varying offset plus negative Date: Mon, 19 Apr 2021 15:39:26 +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: 11.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor 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: cc everconfirmed cf_known_to_work component bug_status short_desc cf_reconfirmed_on cf_known_to_fail 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: Mon, 19 Apr 2021 15:39:27 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100137 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org Ever confirmed|0 |1 Known to work| |10.2.0 Component|c++ |tree-optimization Status|UNCONFIRMED |NEW Summary|-Werror=3Darray-bounds false |[10/11 Regression] |positive:"subscript -1 is |-Warray-bounds false |outside array bounds" |positive on varying offset | |plus negative Last reconfirmed| |2021-04-19 Known to fail| |10.3.0, 11.0 --- Comment #2 from Martin Sebor --- Confirmed. The bug is caused by -Warray-bounds ignoring varying offsets instead of setting the offset range to that of the referenced object.=20 Bisection points to g:e7fd3b783238d034018443e43a58ff87908b4db6 but that just exposed the underlying bug in the warning. The test case triggers the false positive in 10.3.0 and 11.0 but not in 10.2.0 or prior.=20 int main () { ... [local count: 114863531]: # len_11 =3D PHI <18446744073709551615(3), len_23(4)> s =3D{v} {CLOBBER}; s.first_ =3D &hello; iftmp.0_13 =3D &hello + len_11; <<< len_11: VR_VARYING, iftmp.0_13 taken to point to &hello s.last_ =3D iftmp.0_13; _15 =3D len_11 !=3D 0; MEM[(char &)iftmp.0_13 + 18446744073709551615] =3D 50; <<< iftmp.0_13[-= 1] =3D '2'; <<< -Warray-bounds hello =3D{v} {CLOBBER}; s =3D{v} {CLOBBER}; return 0; }=