From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5778F385C403; Fri, 21 Jan 2022 21:26:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5778F385C403 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/104172] New: [9/10/11/12 Regression] ppc64le mangling ICE with -flto -ffat-lto-objects Date: Fri, 21 Jan 2022 21:26:57 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Fri, 21 Jan 2022 21:26:57 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104172 Bug ID: 104172 Summary: [9/10/11/12 Regression] ppc64le mangling ICE with -flto -ffat-lto-objects Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- // { dg-do compile { target { powerpc*-*-* && lp64 && le } } } // { dg-options "-O2 -flto=3Dauto -ffat-lto-objects -mabi=3Dieeelongdouble"= } struct A { A(int); }; struct B { float b; }; struct C : B { C(); }; C::C() { A(b * 25.4L); } ICEs PagePrinter.C: In member function 'C::C()': PagePrinter.C:7:1: internal compiler error: tree check: expected class 'typ= e', have 'declaration' (translation_unit_decl) in base_ctor_omit_inherited_parm= s, at cp/method.c:568 7 | C::C() { A(b * 25.4L); } | ^ 0x101fbd8b tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../gcc/tree.c:8752 0x104073bf tree_class_check(tree_node*, tree_code_class, char const*, int, = char const*) ../../gcc/tree.h:3564 0x104073bf base_ctor_omit_inherited_parms(tree_node*) ../../gcc/cp/method.c:568 0x104073bf base_ctor_omit_inherited_parms(tree_node*) ../../gcc/cp/method.c:560 0x103eda0b write_method_parms ../../gcc/cp/mangle.c:2798 0x103edd73 write_bare_function_type ../../gcc/cp/mangle.c:2758 0x103edecf write_encoding ../../gcc/cp/mangle.c:832 0x103eec7f mangle_decl_string ../../gcc/cp/mangle.c:4034 0x103ef003 get_mangled_id ../../gcc/cp/mangle.c:4055 0x103ef003 mangle_decl(tree_node*) ../../gcc/cp/mangle.c:4093 0x1142297f rs6000_globalize_decl_name ../../gcc/config/rs6000/rs6000.c:28190 0x113d8c43 globalize_decl ../../gcc/varasm.c:6146 0x113e112b assemble_start_function(tree_node*, char const*) ../../gcc/varasm.c:1965 0x10a01a8f rest_of_handle_final ../../gcc/final.c:4281 0x10a01a8f execute ../../gcc/final.c:4363 (for GCC configured to default to --with-long-double-format=3Dieee that is a pretty serious regression breaking lots of builds). The bug is in: /* Create an alias for a mangled name where we have changed the mangling (in GCC 8.1, we used U10__float128, and now we use u9__ieee128). This is ca= lled via the target hook TARGET_ASM_GLOBALIZE_DECL_NAME. */ #if TARGET_ELF && RS6000_WEAK static void rs6000_globalize_decl_name (FILE * stream, tree decl) { const char *name =3D XSTR (XEXP (DECL_RTL (decl), 0), 0); targetm.asm_out.globalize_label (stream, name); if (rs6000_passes_ieee128 && name[0] =3D=3D '_' && name[1] =3D=3D 'Z') { tree save_asm_name =3D DECL_ASSEMBLER_NAME (decl); const char *old_name; ieee128_mangling_gcc_8_1 =3D true; lang_hooks.set_decl_assembler_name (decl); old_name =3D IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); SET_DECL_ASSEMBLER_NAME (decl, save_asm_name); ieee128_mangling_gcc_8_1 =3D false; if (strcmp (name, old_name) !=3D 0) { fprintf (stream, "\t.weak %s\n", old_name); fprintf (stream, "\t.set %s,%s\n", old_name, name); } } } #endif This is just wrong, mangling is only possible before free_lang_data, not af= ter that, everything should be mangled by then. So, IMHO the backend should note that during mangling that it emitted some u9__ieee128 (when rs6000_mangle_type returns it) and through some hook should cooperate with the C++ FE to create a mangling alias like the FE creates mangling aliases for -fabi-version*.=