From patchwork Mon Oct 24 08:25:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 8228 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp319431wru; Mon, 24 Oct 2022 01:26:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7MD2+7Owdi12DKJneLHY4JME/nEaWyZGlEWisRB4e4EnTPlNQdjHVngyFGMY3wBQRAmiy1 X-Received: by 2002:a17:907:2c75:b0:78d:c201:e9aa with SMTP id ib21-20020a1709072c7500b0078dc201e9aamr26529141ejc.235.1666599996974; Mon, 24 Oct 2022 01:26:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666599996; cv=none; d=google.com; s=arc-20160816; b=um50VeSAm7dilMpfGlngvGpurwCjuajtbVv0VMqTOL++WgqLK2lMEGGzfqpe6k7VIK QwNa4EjFITRfhVWElpxe4Y0DsNMlOUACw+tGo17X6j75alVjoVmuheTsKpEbK62FVF7n AaE7EVfU1CfxUs9sxewWl1n3hA64CykP3Gx2LPn3rHMZ9TaxNg9enEEbbd8iqNEVKnEH vxOA8NCHEVZGDBzU8fKP5WChnTj9NaGbM9fziVSx637S2X5x13d44W6mFDMiAQbdJqFN VlhXZAhDbaevDFnmgD3G7zjh3KGZ5HwbI4ojUmrD1h0Wez4xX4VzI+a+sRHHYXQZ07UR NjeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=yqw0Z3ADNpRe3TNDLN8Pn4sHUIcreaWh1PCuNxrw2qA=; b=c4GZOmzrnzqIH1bdLMAa4fu633Nvsr86rP4BDF9Px0hvdXVloc0aRpraJx0e2/znkl LjIW/OiJJ6eDShl8d7eKsQSRDov1tJ8ZuBazWTwlK7BkghNxFnLUjIwt0WJUndWDOIO7 jLECkpJZ5jE2vg2MGz7TrjI3Nl5cWKNXKoac+hjRoQqAdyGi/BMYkl0V0KHECbWubXMG inXedBkEPNAjFbidyvjP+NvZiULB2NmTpXebSc4Muc/k5NigMh3tRPJueFFdXewufiXR 8VDOBDuDwRqw6MObWkPGL04Nq/zXXTxpJAorAgGvaGtUSFb/hOzd7MaZHTWxcpljhIo/ a2aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=pCfp5oN0; 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=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id s10-20020a170906354a00b007891fd9179bsi22940901eja.150.2022.10.24.01.26.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 01:26:36 -0700 (PDT) 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=@gcc.gnu.org header.s=default header.b=pCfp5oN0; 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=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DE5723857C52 for ; Mon, 24 Oct 2022 08:26:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DE5723857C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666599995; bh=yqw0Z3ADNpRe3TNDLN8Pn4sHUIcreaWh1PCuNxrw2qA=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=pCfp5oN08V2GS74aYRxnaVBTfhtxAcObLuqCm+e0x0DfxcRd0lY8aRPWICK991UsK dp+pVQuVAlPIH1ZeuOlpKfJMRclHFMp1fVxZOQkVtApLxK7hgGShGAVZNvnu8SeN3N Sj2W6Ntjt1ePHZypRaP2mObnm9qHWB46a8nVbiPk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id AD7D13858412 for ; Mon, 24 Oct 2022 08:25:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AD7D13858412 Received: by mail-wr1-x42d.google.com with SMTP id z14so1378454wrn.7 for ; Mon, 24 Oct 2022 01:25:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yqw0Z3ADNpRe3TNDLN8Pn4sHUIcreaWh1PCuNxrw2qA=; b=TJw7YkGSJgOLSk9VdIXmb/M3y5HO6Fv7CKjC1yqCvKtXkSlNXlErCzuGeYM0bqETdG gp9quPVyLkKWBcCRB5YOyKzsDf18TWmGDvn+YYrFxcatqKZV9eZQ9qXM7VWFEvAn50AD wi76qkpHghRNw5P9OV5xpjTolxH/1mlY9LIpQwOC6uOMvbCpMDymlK7rkigLUVCNOuVm cdThK2++e4H2NrU3k3s+78Sxzk2zXrCKtyGmyzh5G7rE0+gx2xlddsqH5yYlg53LKu7U xrMQ/EIoou9PAyFcE7tZTVZqlsj4R3oTs3jqSsBEQYlWspSrZZhRd8LQMpxgJKv20aFK fvKQ== X-Gm-Message-State: ACrzQf0r3/jh+GEMauepA6pDupVJOF5KFY1E/YDpgmebLmljZzbxcgNS YHbr7XtOxxeaEW0HxV/HhLuojezE+7KODg== X-Received: by 2002:a5d:668e:0:b0:22f:d914:80ed with SMTP id l14-20020a5d668e000000b0022fd91480edmr20593233wru.45.1666599912454; Mon, 24 Oct 2022 01:25:12 -0700 (PDT) Received: from fomalhaut.localnet ([2a01:e0a:8d5:d990:e654:e8ff:fe8f:2ce6]) by smtp.gmail.com with ESMTPSA id d4-20020a05600c3ac400b003c64c186206sm10206483wms.16.2022.10.24.01.25.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 01:25:11 -0700 (PDT) X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [PATCH] Relax assertion in profile.cc Date: Mon, 24 Oct 2022 10:25:10 +0200 Message-ID: <1910003.PYKUYFuaPT@fomalhaut> MIME-Version: 1.0 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Eric Botcazou via Gcc-patches From: Eric Botcazou Reply-To: Eric Botcazou Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747556758865014216?= X-GMAIL-MSGID: =?utf-8?q?1747556758865014216?= Hi, this assertion in branch_prob: if (bb == ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb) { location_t loc = DECL_SOURCE_LOCATION (current_function_decl); gcc_checking_assert (!RESERVED_LOCATION_P (loc)); had been correct until: 2021-08-11 Bernd Edlinger PR debug/101598 * gcc-interface/trans.c (Subprogram_Body_to_gnu): Set the DECL_SOURCE_LOCATION of DECL_IGNORED_P gnu_subprog_decl to UNKNOWN_LOCATION. was installed. Tested on x86-64/Linux, OK for mainline and 12 branch? 2022-10-24 Eric Botcazou * profile.cc (branch_prob): Be prepared for ignored functions with DECL_SOURCE_LOCATION set to UNKNOWN_LOCATION. 2022-10-24 Eric Botcazou * gnat.dg/specs/coverage1.ads: New test. diff --git a/gcc/profile.cc b/gcc/profile.cc index 96121d60711..1527a04124f 100644 --- a/gcc/profile.cc +++ b/gcc/profile.cc @@ -1457,11 +1457,13 @@ branch_prob (bool thunk) if (bb == ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb) { location_t loc = DECL_SOURCE_LOCATION (current_function_decl); - gcc_checking_assert (!RESERVED_LOCATION_P (loc)); - seen_locations.add (loc); - expanded_location curr_location = expand_location (loc); - output_location (&streamed_locations, curr_location.file, - MAX (1, curr_location.line), &offset, bb); + if (!RESERVED_LOCATION_P (loc)) + { + seen_locations.add (loc); + expanded_location curr_location = expand_location (loc); + output_location (&streamed_locations, curr_location.file, + MAX (1, curr_location.line), &offset, bb); + } } for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))