From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E9ECD3858425; Tue, 20 Dec 2022 15:56:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E9ECD3858425 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671551809; bh=3jieAyS5cRsayQ7KBmbf7EuX3jCLaXFPCjfJ/1KA/Lw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=N+JQLhCWYpUmrCxzsmhQtmClwGED/QKAsiV6XU/gzkaLPm6k3Mxigg7XyoPXCno2C sD70V4fgkSvnRoFgT9vuEZuhHnwwOKdTNLXjeOLL+mnaLe2CQuc8got2BjUbyeRixS tB4Voh7gFOiOtyWxdGZuAq4EQJP7JdVmU0nzAgc0= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107751] [11/12/13 regression] False positive -Wmaybe-uninitialized at -O0 Date: Tue, 20 Dec 2022 15:56:49 +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: 12.2.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: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: priority 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=3D107751 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P2 --- Comment #4 from Richard Biener --- (In reply to Andrew Pinski from comment #2) > Reduced testcase (removes the templates, also now able to compile as C): > typedef const int T1; > typedef const int T2; > void std_equal(T1* a1, T1* a2, T2* b1); > void f() { > int a[3] =3D {1, 2, 3}; > T1* x =3D a; > T2* y =3D a; > std_equal(x, x+3, y); > } It's also odd we diagnose x + 3 but not x + 2. We're using ao_ref_init_from_ptr_and_size but that's not a good measure, esp. for /* Do not warn if the access is zero size or if it's fully outside the object. */ poly_int64 decl_size; if (known_size_p (ref.size) && known_eq (ref.max_size, ref.size) && (known_eq (ref.size, 0) || known_le (ref.offset + ref.size, 0))) return NULL_TREE; also given that this function doesn't do a good job at gettting at &a for the IL at -O0 which is : a[0] =3D 1; a[1] =3D 2; a[2] =3D 3; x_6 =3D &a; y_7 =3D &a; _1 =3D x_6 + 8; std_equal (x_6, _1, y_7); note that a function receiving x + O can adjust this pointer before reading from it so using [x+O, +INF] as access range to find initialization isn't the best thing to do.=