From patchwork Sun Aug 29 16:31:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1521973 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=hqjX+aW/; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 ozlabs.org (Postfix) with ESMTPS id 4GyJsQ65Y6z9sVw for ; Mon, 30 Aug 2021 02:32:56 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 26FBD3858036 for ; Sun, 29 Aug 2021 16:32:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 26FBD3858036 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1630254772; bh=McSht16bQ8F/BBB9vH08kIrFheM8JCOQVODEtP0+rgg=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=hqjX+aW/Fv/mtHMhD+1YlbbFpQ3C8NcZWnBBkgXoRsO77BbhY0tkXq8HodAKZu0al Uko+lalv2l0XQ0ED6P5GExxnBuBJrMb+MuIl5iRgNauSeM5G9TecWv/PInkXMY5+go 8xKSoc6lF/zehZ8oBKhF7R+Bnwy1GKmzaiqnNEE8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by sourceware.org (Postfix) with ESMTPS id 3E4D83857C4E for ; Sun, 29 Aug 2021 16:31:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3E4D83857C4E Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:105:465:1:4:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4GyJqq5vnHzQk03; Sun, 29 Aug 2021 18:31:35 +0200 (CEST) Received: from spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) by smtp202.mailbox.org (Postfix) with ESMTP id F09BD26D; Sun, 29 Aug 2021 18:31:33 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp202.mailbox.org ([80.241.60.245]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id wJT_VCo2gdXc; Sun, 29 Aug 2021 18:31:29 +0200 (CEST) Received: from galago.. (unknown [IPv6:2a02:8109:8680:293c:4a75:a36c:72fb:f6f8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp202.mailbox.org (Postfix) with ESMTPSA id 2795A267; Sun, 29 Aug 2021 18:31:29 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [committed] d: ICE in gimple_register_canonical_type_1, at lto/lto-common.c:430 (PR102094) Date: Sun, 29 Aug 2021 18:31:26 +0200 Message-Id: <20210829163126.2036025-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: F09BD26D X-Rspamd-UID: 492785 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Iain Buclaw via Gcc-patches From: Iain Buclaw Reply-To: Iain Buclaw Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi, User defined types have the TYPE_CXX_ODR_P flag set, but closure frames did not. This mismatch led to an ICE in the conflict detection for ODR and interoperable non-ODR types. As a given closure frame is tied explicitly to a function, it already conforms to ODR. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, committed to mainline. Regards, Iain --- gcc/d/ChangeLog: PR d/102094 * d-codegen.cc (build_frame_type): Set TYPE_CXX_ODR_P. gcc/testsuite/ChangeLog: PR d/102094 * gdc.dg/lto/pr102094_0.d: New test. --- gcc/d/d-codegen.cc | 1 + gcc/testsuite/gdc.dg/lto/pr102094_0.d | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 gcc/testsuite/gdc.dg/lto/pr102094_0.d diff --git a/gcc/d/d-codegen.cc b/gcc/d/d-codegen.cc index fe2ad98e60a..ad20bd15403 100644 --- a/gcc/d/d-codegen.cc +++ b/gcc/d/d-codegen.cc @@ -2563,6 +2563,7 @@ build_frame_type (tree ffi, FuncDeclaration *fd) TYPE_FIELDS (frame_rec_type) = fields; TYPE_READONLY (frame_rec_type) = 1; + TYPE_CXX_ODR_P (frame_rec_type) = 1; layout_type (frame_rec_type); d_keep (frame_rec_type); diff --git a/gcc/testsuite/gdc.dg/lto/pr102094_0.d b/gcc/testsuite/gdc.dg/lto/pr102094_0.d new file mode 100644 index 00000000000..f83631a1158 --- /dev/null +++ b/gcc/testsuite/gdc.dg/lto/pr102094_0.d @@ -0,0 +1,18 @@ +// { dg-lto-do link } +module pr102094_0; + +extern(C) int printf(char* s, ...); + +struct S102094 +{ + int a; +} + +void main() +{ + S102094 x; + void nested() + { + printf(cast(char*)0, x); + } +}