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: 209270 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp701789dyc; Sat, 2 Mar 2024 16:11:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWnuM8ttjqkjdaAtFyPs5p3LcWMrrjeWBcBCG5pllttQHlDBQujbtxKsMXppqchXYJcXljldhypopIqF1Oy9XsQBZu8pA== X-Google-Smtp-Source: AGHT+IGNMp+W8L9g2atB9MiMJucEhLwY4mgs06M8U6+jb6vF50vBxr9XZ4XVdsFWry3fpw3+bOlP X-Received: by 2002:a05:620a:f85:b0:787:f9fd:acfe with SMTP id b5-20020a05620a0f8500b00787f9fdacfemr5354793qkn.20.1709424699964; Sat, 02 Mar 2024 16:11:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709424699; cv=pass; d=google.com; s=arc-20160816; b=oKZ3218A+kdyA96sQ5PivGBROT4ACbjFghOmXDZEQOl8ocZDCTYbE+2Y311jPTD0xI 5Ez+7bCDj1+oXnkwlcOV3vtkUwsVgGBxrWoVLZRbiMFn/IKSIlRMbgEKsTViDJStaAee /STELPUTAQpvXVDXUCQ83oW8mNjj93pDqMzFgvbXY7Kl+qT3hAD65IaTXagsSAu6FKp5 OuXHjFe01EUzwof/W3/8WAYJPBA2ctFLDZONA0vqXP6Jq33PqczW3hLsAosuD/7iojd4 56MR0bE+gf6VHhsd25kCr4r99vFVh+OzXe862L2X5+k+SysWMV5LOHegWAnO5y2ZsLnh 42og== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=vh5j6WTJ/dJBwDdT3Dtfh/p1dq8B98QBHyu4lFyKa1w=; fh=D2tRalIjW6KCgVuqwFHStdMb9uqe8HSQc2WEvRJ6uLE=; b=eM893DEzp/xrhP7mgoSDLjI50+MqB/OLD89obAKTPo4RRYWO9JiK65EhrwD3e3OeKf hN7V2+L9Ccetjj/cJb0Rujb70svDjKjNkXPI8dmYV2wttKN7QqFl4lnaigqUK/c7ZMMb 1s1L+bk0M9IY2w7Bg82Ax+bbBRrz5LocJrCq/f/MVe7a3Es5YEbB5eevag4zS5xhGmou FEPm8GutBpQDEJvg75zFIHy4HlYyA1gubqLXnmPRdt7Mbv7RPAWZkbzjS5c4od6lhawB Rj7TJuom1Ah6yu16cYa3R/+oEf1j95sYt+W8fzaCgQ3VQD5v93T61LPG3jTuuFpPalj2 5tpQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gdcproject.org header.s=MBO0001 header.b=i5axlEac; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gdcproject.org Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id j7-20020a05620a0a4700b007881c49c39esi1711179qka.697.2024.03.02.16.11.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 16:11:39 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gdcproject.org header.s=MBO0001 header.b=i5axlEac; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gdcproject.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9CD623858414 for ; Sun, 3 Mar 2024 00:11:39 +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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792461714377522970 X-GMAIL-MSGID: 1792461714377522970 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;