From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 61A603858D20; Fri, 27 Jan 2023 03:29:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 61A603858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674790178; bh=gcQK/RQEiqoPNhUv9sHAuxnuXojjYCFgpS/Wkuy0BSo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=A7CKWQ5uLBvYXtRSlwlCgjTxHhpEqNxGPGlSudFQkDAlJrz+T0J4Gx/yirpUEep0X GgOoWgeioaUrQuPi+VBTCsEcoPgRV6Z6N6f3SEaMpzuedDCQ728J52fDQ8UQ5VIarA IoUmGfCSMH2TFF8g3fKckqTl8JgXZyrh5MfudKvk= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108566] ICE: tree check: expected tree that contains 'decl with visibility' structure, have 'field_decl' in write_unqualified_name with anonymous struct inside an anonymous union Date: Fri, 27 Jan 2023 03:29:38 +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: 13.0 X-Bugzilla-Keywords: ABI, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org 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=3D108566 --- Comment #3 from Andrew Pinski --- Note this is using a GCC extension so this might not be as important. clang mangles the symbol as: _Z5dummyIXtl8wrapper1IdEtlNS1_Ut_Edi9RightNametlNS2_Ut_ELd405ec00000000000E= EEEEEvv Which does demangle to: void dummy{wrapper1::{unnamed type#1}{.RightName=3D{unnamed type#1}::{unnamed type#1}{(double)[405ec00000000000]}}}>() If you change it to: ``` template struct wrapper1 { union { struct { double hh; double hh1; }; }; }; template void dummy(){} void uses() { dummy{123.0, 123.0}>(); } ``` clang mangles the symbol as: _Z5dummyIXtl8wrapper1IdEtlNS1_Ut_Edi2hhtlNS2_Ut_ELd405ec00000000000ELd405ec= 00000000000EEEEEEvv Which demangles as: void dummy{wrapper1::{unnamed type#1}{.hh=3D{unnam= ed type#1}::{unnamed type#1}{(double)[405ec00000000000], (double)[405ec00000000000]}}}>() But takes the name of the struct from the first field ... Which might be what GCC is trying to do but it fails. Here is a more complex test (wrapper1 does not need to be a template to get= the crash): struct wrapper1 { union { struct { union { double hh; double hh1; }; }; }; }; template void dummy(){} void uses() { dummy(); } clang's mangled named: _Z5dummyIXtl8wrapper1tlNS0_Ut_Edi2hhtlNS1_Ut_EtlNS2_Ut_Edi2hhLd405ec0000000= 0000EEEEEEEvv Which demangles as: void dummy() Notice the use of the first field's name.=