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: 59340 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 52A0138582B4 for ; Mon, 24 Oct 2022 08:26:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 52A0138582B4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666599966; bh=yqw0Z3ADNpRe3TNDLN8Pn4sHUIcreaWh1PCuNxrw2qA=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=VlDkzihtJ0fJOfJyENOQuuN+QCQcuCrejR5aEmYFpCr1yrgXtkH90IJip4TS3eJSD ojPGGWVeQDbes3LgNuG9+XIOkSg0f+Gs96FFzxmFWaI1CxVlCdRX2zrR3UyrhEdCcf QB7fKxX8WHPJXymv46O4/MvU+weZSDxB2Q1Be3G0= 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-Google-Smtp-Source: AMsMyM4PkN6ao3zmj4q+BJ75i+VryJx56SbrvV6y5dxlpMwgAyoP09COqen4i9EpI1SGfQ+Q7266gw== 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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))