From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 77D173858433; Sun, 26 Feb 2023 00:18:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 77D173858433 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677370682; bh=/OivcN4G/sygbLkEfVBKMa3hawC3RmYCL6DeecrSjec=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qcbl5rV5NzlCHL6UL7lhFQd8hh9MR+NqNpx+TjGhr5iIvKT//bZuqf9go0QtqzB0x oUyOnoLizuTOtfI7pdiKMaWVXROK5wVJxTqj+4Rfa3YWoqPR2Ol8uWZ+MNR1okFH6K Maxtz/404yrJrHrXkOHB7GK38JjM8R8MtE44rwBY= From: "ibuclaw at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug d/108877] Explicit immutable struct import internal compiler error Date: Sun, 26 Feb 2023 00:17:55 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: d X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ibuclaw at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ibuclaw at gdcproject dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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=3D108877 ibuclaw at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ibuclaw at gcc dot gnu.org --- Comment #1 from ibuclaw at gcc dot gnu.org --- Immutable is the keyword here. Stub debug symbols are only attached to the = main variant of a type. I think this would also be reproducible with `immutable class` and `immutable enum` as well. Have fix really to commit and backport once I test it. --- diff --git a/gcc/d/imports.cc b/gcc/d/imports.cc index 3b46d1b7560..2efef4ed54f 100644 --- a/gcc/d/imports.cc +++ b/gcc/d/imports.cc @@ -106,12 +106,16 @@ public: tree type =3D build_ctype (d->type); /* Not all kinds of D enums create a TYPE_DECL. */ if (TREE_CODE (type) =3D=3D ENUMERAL_TYPE) - this->result_ =3D this->make_import (TYPE_STUB_DECL (type)); + { + type =3D TYPE_MAIN_VARIANT (type); + this->result_ =3D this->make_import (TYPE_STUB_DECL (type)); + } } void visit (AggregateDeclaration *d) final override { tree type =3D build_ctype (d->type); + type =3D TYPE_MAIN_VARIANT (type); this->result_ =3D this->make_import (TYPE_STUB_DECL (type)); } @@ -119,6 +123,7 @@ public: { /* Want the RECORD_TYPE, not POINTER_TYPE. */ tree type =3D TREE_TYPE (build_ctype (d->type)); + type =3D TYPE_MAIN_VARIANT (type); this->result_ =3D this->make_import (TYPE_STUB_DECL (type)); }=