From patchwork Tue May 26 13:55:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 1298099 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@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com 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 49Wb7s3Bxfz9sPF for ; Tue, 26 May 2020 23:55:21 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 51BD83894433; Tue, 26 May 2020 13:55:19 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id E808C386F432 for ; Tue, 26 May 2020 13:55:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E808C386F432 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Tobias_Burnus@mentor.com IronPort-SDR: NfUrtOuGwSFMu1b1I7s3sN1WgVK50QLeePQM83aJTA8URuX9axngNorWYAKAPS/FKNoWWkD1yx Yus9ckfc10T73d+8EjV8J/EYtu3I5Y5mM90JUzD8L48oXreGDPoMxfsyRDcoCjC+4tmUkR/Ghr M16cjXTyzoClxKqXluTQndYwecJVHy1y1GuEOElGK1/CeHj9JPtUlfArh/rQ6f1way3spjLkaH LN7u8T1ou8iBxLt412ldI8T1Bii25WznV+FgxlulW5uUqF6fK0QIHCfx55T6Buoc34a+A+/IXF PGo= X-IronPort-AV: E=Sophos;i="5.73,437,1583222400"; d="diff'?scan'208";a="49192146" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 26 May 2020 05:55:14 -0800 IronPort-SDR: kqhLvfOd/pubsxj2rF8Dy4/TTFP0hXYd17VmOopuQ6ANG23cFkcYxNrXjFcolfoUzr3AlbDIoZ Yn1V/0nj4lClWEiLTIAc80QftL+TKxo+7spJiDDRYK3Ck/ENGSZ+LSVgwwmS7xGOTxfxKXLcwe XuYBndON5uf5AX+Pkz2Apar9pkrVhTHrE1tfbehwjVIIh1cIMlbVofTUHvJ7f3LObbXmgQp2qT Y2dGXw0knVH+4DnWclO+CXon20Y54v0K1JnBN8dViQg2I3haS2+2GsN2ig2/H2WTGRLND1ANsk vYc= From: Tobias Burnus Subject: [LTO/offloading] Fix offloading-compilation ICE without -flto (PR84320) To: gcc-patches , Jan Hubicka , Richard Biener Message-ID: <09cfa364-d690-2172-1a10-e90e6fef51c2@codesourcery.com> Date: Tue, 26 May 2020 15:55:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 Content-Language: en-US X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-07.mgc.mentorg.com (139.181.222.7) To SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) X-Spam-Status: No, score=-15.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" LTO stream out not only happens with LTO (-flto) but also for the offloaded functions with OpenMP/OpenACC. Without using -flto, this leads to an ICE as a recent patch (r11-525-g03d90a20a1afcbb9c30da8d4adf4922b0685061f) added the check to DFS::DFS (lto-streamer-out.c:639): if (ob->local_trees && local_tree_p (expr)) where local_tree_p calls odr_type_t. And the latter that contains the following assert, which fails: /* We do not have this information when not in LTO, but we do not need to care, since it is used only for type merging. */ gcc_checking_assert (in_lto_p || flag_lto); Adding 'in_lto_p &&' before the 'odr_type_t (t) &&' in local_tree_p works for offloading but this causes an ICE: FAIL: g++.dg/asan/pr85774.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) lto1: internal compiler error: in unify_scc, at lto/lto-common.c:1678 Hence, the simple solution is to add flag_generate_offload to the assert, which this patch does. OK for the trunk? Tobias ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter [LTO/offloading] Fix offloading-compilation ICE without -flto (PR84320) gcc/ChangeLog: PR ipa/95320 * ipa-utils.h (odr_type_p): Also permit calls with only flag_generate_offload set. gcc/ipa-utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ipa-utils.h b/gcc/ipa-utils.h index 98edc383461..d0ac3ec86f8 100644 --- a/gcc/ipa-utils.h +++ b/gcc/ipa-utils.h @@ -243,7 +243,7 @@ odr_type_p (const_tree t) { /* We do not have this information when not in LTO, but we do not need to care, since it is used only for type merging. */ - gcc_checking_assert (in_lto_p || flag_lto); + gcc_checking_assert (in_lto_p || flag_lto || flag_generate_offload); return TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL && DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t)); }