From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6852E3858D39; Mon, 15 Nov 2021 15:40:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6852E3858D39 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/101597] [12 Regression] ICE in pretty-printer formatting an OBJ_TYPE_REF since r12-2132-ga110855667782dac Date: Mon, 15 Nov 2021 15:40:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.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 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, 15 Nov 2021 15:40:23 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101597 --- Comment #4 from Jakub Jelinek --- I guess the problem is that for the middle-end, pointer conversions are considered useless (with the small exceptions or different address spaces a= nd function/method vs. object pointers or if the pointers have different TYPE_MODE), so trying to figure out something from the type of OBJ_TYPE_REF's OBJ_TYPE_REF_OBJECT operand is wrong. So, either we want to print something ugly, e.g. with obj_type_ref in it somewhere, if !virtual_method_call_p (t, true), or perhaps could change aall the spots that create OBJ_TYPE_REFs such that the OBJ_TYPE_REF_TOKEN which I think must be INTEGER_CST wouldn't have integer_type_node type, but would actually have the original type of the second argument of OBJ_TYPE_REF. E.g. in build_vfn_ref instead of doing aref =3D build3 (OBJ_TYPE_REF, TREE_TYPE (aref), aref, instance_ptr, idx); do aref =3D build3 (OBJ_TYPE_REF, TREE_TYPE (aref), aref, instance_ptr, fold_convert (TREE_TYPE (instance_ptr), idx)); or so and use that for resolve_virtual_fun_from_obj_type_ref purposes. It would be similar to what we do e.g. with MEM_REFs. Devirtualization and constexpr virtual call handling would need to be verif= ied for that change of course.=