From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B89CB385842E; Mon, 20 Mar 2023 17:20:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B89CB385842E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679332846; bh=z/6A2TN9RFurOSh7L7eKDIwnv4hG2XiMPHyNpkT/Rt4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hh0U9iPA3soRYr3X7Goivv2RBYqE1o4dlurYuFLcMmCrYpJShJPc0U/yCCpNr84lu CPQ0DDCEAAKBiiFTClUnVYmc2eUEV1qMO8lR0DJY3ePWtqMQE1O6fUu9K/wghwIIw1 NsKyMsRgDE/LgkRISMRoMaU/buBxdZ+7Y40u+d6s= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: =?UTF-8?B?W0J1ZyB0cmVlLW9wdGltaXphdGlvbi8xMDkyMTVdIFsxMyBSZWdy?= =?UTF-8?B?ZXNzaW9uXSB3cm9uZyB3YXJuaW5nOiBhcnJheSBzdWJzY3JpcHQgMCBpcyBv?= =?UTF-8?B?dXRzaWRlIHRoZSBib3VuZHMgb2YgYW4gaW50ZXJpb3IgemVyby1sZW5ndGgg?= =?UTF-8?B?YXJyYXkg4oCYc3RydWN0IGxvY2tfY2xhc3Nfa2V5WzNd4oCZ?= Date: Mon, 20 Mar 2023 17:20:46 +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: jakub 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: 13.0 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109215 --- Comment #4 from Jakub Jelinek --- Slightly simplified -O2 -Wall: struct S {}; struct T { struct S s[3]; struct S t; }; void bar (struct S *); void foo (struct T *t) { for (int i =3D 0; i < 3; i++) bar (&t->s[i]); } On: void baz (struct T *t) { for (int i =3D 0; i < 4; i++) bar (&t->s[i]); } we on the other side don't warn iN GCC 12 even when we probably should: fre3 in that case replaces: _10 =3D &t_5(D)->s[0]; bar (_10); _15 =3D &t_5(D)->s[1]; bar (_15); _20 =3D &t_5(D)->s[2]; bar (_20); _25 =3D &t_5(D)->s[3]; bar (_25); with _10 =3D &t_5(D)->s[0]; bar (_10); bar (_10); bar (_10); bar (_10); and the warning is only in vrp1. void qux (struct T *t) { bar (&t->s[2]); } void corge (struct T *t) { bar (&t->s[3]); } are then even simpler cases. r13-4521 and later warns for all those, GCC 12 for none of those.=