From patchwork Sun Mar 3 00:10:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1907192 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gdcproject.org header.i=@gdcproject.org header.a=rsa-sha256 header.s=MBO0001 header.b=i5axlEac; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TnMgV5D0yz23fC for ; Sun, 3 Mar 2024 11:11:17 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AA4FF385841B for ; Sun, 3 Mar 2024 00:11:13 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [IPv6:2001:67c:2050:0:465::201]) by sourceware.org (Postfix) with ESMTPS id 9B6533858C31 for ; Sun, 3 Mar 2024 00:10:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9B6533858C31 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=gdcproject.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gdcproject.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9B6533858C31 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:67c:2050:0:465::201 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709424654; cv=none; b=wocCSdzKuTgxYQRrTp6Jx1kJmAOdKB0Nojiy1GncFsaTOYoI4z7TfUfQUkmU5UXJ7DGPJUhWnKQv9Qa8MMQhbPkmwlKX5D0kl0Awocgc2AjjRvDFkz6nWoYLow9U0BTnUsYOaXBTtlrrMAjuoaR2I8isE334ajIDCVlyuCm2KRA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709424654; c=relaxed/simple; bh=3A3OXpQ8ZnjagJkP3Tjf+uulrrVWfbUv9l0zty52gL0=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=OBLz5YR8wrw6fF+aZxKs/eL65+gWVoAF+5Lxfj7p1I8kw20xrWWmexyCAoGPK3w0l0ieIjixMH+2Jng6i4m2ZnDLYTQ4u2y/Ei2D+ULr3Ecoz9ei9b+DQIXv6p1q8Iqad94emS3JcfJconBWvbPRl8q2C2GXQenIgREl6dpfYTY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4TnMfx4HqSz9t2x; Sun, 3 Mar 2024 01:10:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gdcproject.org; s=MBO0001; t=1709424649; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=vh5j6WTJ/dJBwDdT3Dtfh/p1dq8B98QBHyu4lFyKa1w=; b=i5axlEacnxH5HzHH6JN89kbdE2ZOw9r/a9IxEsA4Dh5NZpiW4RiIqb4WF92IJUxeX3GUyZ F6a+ec3SwCFmKRQcp+rvztqmBIdofc+35MUx8JVjc2JkvzlWYKIKOzSbcNbdriAis1xsR7 TEiza0/jMhgbViT71GXcb/kiiTRxv/sF3/qf6rcZIaJPGbtmqa5N2TIQbyiNDTdf0UN6JY dZtst5QoKH5NU0ydwR0J/vHtz1W02As1H8/yafXaOcvrqO87aNJr4R0WHAbuK8l9u86GGY WfglEuyc9w2B9QOfcROqFT8BuUWubx4KU83SL1GNY62eXjUk5pytX1yiay6fWg== From: Iain Buclaw To: gcc-patches@gcc.gnu.org Cc: Iain Buclaw Subject: [committed][GCC13] d: Fix internal compiler error: in make_import, at d/imports.cc:48 [PR113125] Date: Sun, 3 Mar 2024 01:10:46 +0100 Message-Id: <20240303001046.803072-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, URIBL_BLACK, WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi, This patch backports an ICE triggered in the D front-end. The cause of the ICE was that TYPE_DECLs were only being generated for structs with members, not opaque structs. Bootstrapped and regression tested on x86_64-linux-gnu/-m32, backported to releases/gcc-13, releases/gcc-12, and releases/gcc-11. Regards, Iain. --- PR d/113125 gcc/d/ChangeLog: * types.cc (TypeVisitor::visit (TypeStruct *)): Generate TYPE_DECL and apply UDAs to opaque struct declarations. gcc/testsuite/ChangeLog: * gdc.dg/imports/pr113125.d: New test. * gdc.dg/pr113125.d: New test. (cherry picked from commit b0efb1c35724e3332ee5993976efb98200c1a154) --- gcc/d/types.cc | 5 +++++ gcc/testsuite/gdc.dg/imports/pr113125.d | 2 ++ gcc/testsuite/gdc.dg/pr113125.d | 4 ++++ 3 files changed, 11 insertions(+) create mode 100644 gcc/testsuite/gdc.dg/imports/pr113125.d create mode 100644 gcc/testsuite/gdc.dg/pr113125.d diff --git a/gcc/d/types.cc b/gcc/d/types.cc index f19779fec7d..05050f9edd0 100644 --- a/gcc/d/types.cc +++ b/gcc/d/types.cc @@ -1230,6 +1230,11 @@ public: apply_user_attributes (t->sym, t->ctype); finish_aggregate_type (structsize, alignsize, t->ctype); } + else + { + build_type_decl (t->ctype, t->sym); + apply_user_attributes (t->sym, t->ctype); + } /* For structs with a user defined postblit, copy constructor, or a destructor, also set TREE_ADDRESSABLE on the type and all variants. diff --git a/gcc/testsuite/gdc.dg/imports/pr113125.d b/gcc/testsuite/gdc.dg/imports/pr113125.d new file mode 100644 index 00000000000..761e613b055 --- /dev/null +++ b/gcc/testsuite/gdc.dg/imports/pr113125.d @@ -0,0 +1,2 @@ +module imports.pr113125; +struct S113125; diff --git a/gcc/testsuite/gdc.dg/pr113125.d b/gcc/testsuite/gdc.dg/pr113125.d new file mode 100644 index 00000000000..cb7300baa1a --- /dev/null +++ b/gcc/testsuite/gdc.dg/pr113125.d @@ -0,0 +1,4 @@ +// { dg-do compile } +// { dg-options "-I $srcdir/gdc.dg" } +module pr113125; +import imports.pr113125: S113125;