From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D654A3858401; Wed, 10 Aug 2022 13:19:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D654A3858401 From: "hubicka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/101839] [10/11/12/13 Regression] Hang in C++ code with -fdevirtualize Date: Wed, 10 Aug 2022 13:19:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka 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: 10.5 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 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: Wed, 10 Aug 2022 13:19:38 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101839 --- Comment #9 from Jan Hubicka --- Thanks for looking into this.=20=20 What happens here is that we start working from a call where we know that outer_type is BA. We correctly find the BA::type and notice that it is final and thus we do not need to look for sucessors to find something. However we later decide to discard it here: 3241 if (type_possibly_instantiated_p (outer_type->type)) 3244 skipped =3D true; This is trying to check, for anonymous types, the possibility that a given target is never going to be taken since type was never instantiated. It is = true that BA is not instantiated however its successor is. So we need to keep t= rack that we saw FINAL and in that case extend type_possibly_instantiated_p to a= lso look for all derived types. This is quite ugly mistake I got in as the possibly_instantiated code was implemented before we got DECL_FINAl flag. I will prepare patch.=