From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6A3E53858C56; Sun, 16 Oct 2022 17:27:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A3E53858C56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665941266; bh=ZnQrhwAr48HfHF3IFjHUFawUIrZU30QibbfYDBe4+zU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=p9HnF1seCowKGjCyM+bbe2DjlJrkRgsPTbnDHJOZ5IcdqX3HAuxgsJYTDCTGR5Nb5 2goxTsJ7qjvq5KK6ukdhmBGm9w0gGAzXv+bXl2p0VRx+6FZeJPKsj1cNwmQLXXGhyZ Gz3V9MtYj9icB6fD51dtQeIUCMWlLFLeTPFBtveA= From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107206] Bogus -Wuninitialized in std::optional Date: Sun, 16 Oct 2022 17:27:44 +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.1.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de 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: 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=3D107206 --- Comment #6 from rguenther at suse dot de --- > Am 14.10.2022 um 18:53 schrieb jamborm at gcc dot gnu.org : >=20 > =EF=BB=BFhttps://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107206 >=20 > --- Comment #5 from Martin Jambor --- > I believe this is fallout from the fix to PR 92706 where we started > propagating accesses across assignments also from LHS to RHS and > because everything is totally flow-insensitive, we have an access > representing: >=20 > MEM[(union _StorageD.10576 *)&D.11678]._M_valueD.10616 =3D 1; >=20 > which gets propagated across: >=20 > zD.11527.yD.11476.oD.11384 =3D D.11678; >=20 > but this then triggers the LHS->RHS propagation across: >=20 > MEM[(struct YD.10174 *)&zD.11527].oD.11384 =3D MEM[(const struct YD.10174 > &)&D.11546].oD.11384; >=20 > So another reason to re-invent SRA from scratch. Yes > Apart from that, I > don't have a good solution except for adding another flag to mark > accesses that are result of LHS->RHS propagation and ignore them if > their base did not get totally scalarized because in the PR they were > added basically to prevent bad total scalarization. But of course it > is rather another band-aid than a real fix, but it seems to work for > this case: >=20 > diff --git a/gcc/tree-sra.cc b/gcc/tree-sra.cc > index 1a3e12f18cc..6cbeddfc548 100644 > --- a/gcc/tree-sra.cc > +++ b/gcc/tree-sra.cc > @@ -260,6 +260,9 @@ struct access >=20 > /* Should TREE_NO_WARNING of a replacement be set? */ > unsigned grp_no_warning : 1; > + > + /* Result of propagation accross link from LHS to RHS. */ > + unsigned grp_result_of_prop_from_lhs : 1; > }; >=20 > typedef struct access *access_p; > @@ -2532,6 +2535,9 @@ analyze_access_subtree (struct access *root, struct > access *parent, > if (allow_replacements && expr_with_var_bounded_array_refs_p (root->exp= r)) > allow_replacements =3D false; >=20 > + if (!totally && root->grp_result_of_prop_from_lhs) > + allow_replacements =3D false; > + > for (child =3D root->first_child; child; child =3D child->next_sibling) > { > hole |=3D covered_to < child->offset; > @@ -2959,6 +2965,7 @@ propagate_subaccesses_from_lhs (struct access *lacc, > struct access *racc) > struct access *new_acc > =3D create_artificial_child_access (racc, lchild, norm_offset, > true, false); > + new_acc->grp_result_of_prop_from_lhs =3D 1; > propagate_subaccesses_from_lhs (lchild, new_acc); > } > else LGTM=