From patchwork Wed Oct 10 22:54:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 982138 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-487298-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="r3YJ8MG9"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42VqDR2ct9z9s7W for ; Thu, 11 Oct 2018 09:54:45 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=ToOPk63MElqn3p30 39tN9+yEBYCwykt8qsOdLWAHlRZLXEwhgD/Pr9EXOnDERRODTPp+cT1VaUoReP7n KDTTaoMmexrq/umyljfazR/rMRlJElSK5AJwYmp6c2+/QTZ3E1586kTSO8XIS+0m mlHoF7QBjUndlH2IhFhrVR5fClc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=dOS25uqhBTMeVU98r0O1Qp h35dI=; b=r3YJ8MG9NWP8TvF1rtL34Vx/w7+wgfJg4JkFUU4jBXsOi+Ki+5lhzv K7OAz9+dv3cEoiOFijGePlxFZHTgcAoIvihJCDLtJ7Vbx9Kfww2c9MMmqhQMVluk JKzoeurqv1SwmLVz7QABmNNFPROasnP+TCDUhrUVEtq17VDbS4t2A= Received: (qmail 9116 invoked by alias); 10 Oct 2018 22:54:38 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 9082 invoked by uid 89); 10 Oct 2018 22:54:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=U*ebotcazou, ebotcazouadacorecom, sk:ebotcaz, ebotcazou@adacore.com X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 Oct 2018 22:54:35 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id C79448138E for ; Thu, 11 Oct 2018 00:54:32 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Zyl5cGUQ6Pao for ; Thu, 11 Oct 2018 00:54:32 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 8BF3181353 for ; Thu, 11 Oct 2018 00:54:32 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Fix PR middle-end/87574 Date: Thu, 11 Oct 2018 00:54:08 +0200 Message-ID: <2088304.ITDu5v2iMG@polaris> MIME-Version: 1.0 It turns out that, even if cgraph_node::expand_thunk happily overrides the DECL_IGNORED_P setting on the thunk from the front-end, this is necessary when the thunk is initially a back-end thunk and then turned into a GIMPLE thunk, e.g. because of inlining, to play nice with early debug info generation. So the patch reinstates the overriding, but only when expanding to GIMPLE. Tested on x86-64/Linux, applied on the mainline as obvious. 2018-10-10 Eric Botcazou PR middle-end/87574 * cgraphunit.c (cgraph_node::expand_thunk): Force DECL_IGNORED_P on the thunk when expanding to GIMPLE. 2018-10-10 Eric Botcazou * g++.dg/other/pr87574.C: New test. Index: cgraphunit.c =================================================================== --- cgraphunit.c (revision 264986) +++ cgraphunit.c (working copy) @@ -1862,6 +1862,12 @@ cgraph_node::expand_thunk (bool output_a DECL_ARGUMENTS. In this case force_gimple_thunk is true. */ if (in_lto_p && !force_gimple_thunk) get_untransformed_body (); + + /* We need to force DECL_IGNORED_P when the thunk is created + after early debug was run. */ + if (force_gimple_thunk) + DECL_IGNORED_P (thunk_fndecl) = 1; + a = DECL_ARGUMENTS (thunk_fndecl); current_function_decl = thunk_fndecl;