From patchwork Tue Dec 22 21:07:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1419526 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=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gcc.gnu.org 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=eBFtl1w+; dkim-atps=neutral Received: from sourceware.org (unknown [8.43.85.97]) (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 4D0tWm1Z4Jz9sVj for ; Wed, 23 Dec 2020 10:55:46 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3A7A3388A80D; Tue, 22 Dec 2020 23:55:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3A7A3388A80D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1608681340; bh=fX0kqnqyPlyg6k5C6nCEnI/F6NzLTkU3nJy6nsm/ZkQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=eBFtl1w+C9U22oqLWd5bHg6OJWq5QkKAnn3ZRRpOeKxc7+hrXnZQsGNGGaGeHm4jZ kLBodMb5rbZ5+SEUhuFEzwF3jq3/dqcbJh+I7drR4b4eTCFFWzBYBbRK74xb4oxNs3 Oos1+NyAo4NmfAkb4Eq5vyKjUChkR8iUta6XnsbY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 3410D38350BE for ; Tue, 22 Dec 2020 23:55:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3410D38350BE Received: from linux-libre.fsfla.org ([209.51.188.54]:56918 helo=free.home) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krrVA-0001zB-Qi; Tue, 22 Dec 2020 18:55:37 -0500 Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 0BML7G4b055480 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Dec 2020 18:07:17 -0300 To: gcc-patches@gcc.gnu.org Subject: [PR97714] final: accept markers at line 0 Organization: Free thinker, not speaking for the GNU Project Date: Tue, 22 Dec 2020 18:07:16 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_NUMSUBJECT, SPF_HELO_PASS, 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: , X-Patchwork-Original-From: Alexandre Oliva via Gcc-patches From: Alexandre Oliva Reply-To: Alexandre Oliva Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Back when I introduced debug markers, I seem to have been under the impression that location line 0 would only ever occur for unknown and builtin locations. Though line 0 never comes up in normal processing of source files, and debug info formats often cannot represent them, I suppose there's no need to preemptively discard them during final. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ChangeLog PR debug/97714 * final.c (notice_source_line): Narrow down the condition to skip a line-0 marker. for gcc/testsuite/ChangeLog PR debug/97714 * gcc.dg/pr97714.c: New. --- gcc/final.c | 11 +++++------ gcc/testsuite/gcc.dg/debug/pr97714.c | 11 +++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/debug/pr97714.c diff --git a/gcc/final.c b/gcc/final.c index fc9a05e335f47..45f7f39f0885b 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -3250,12 +3250,11 @@ notice_source_line (rtx_insn *insn, bool *is_stmt) { location_t loc = NOTE_MARKER_LOCATION (insn); expanded_location xloc = expand_location (loc); - if (xloc.line == 0) - { - gcc_checking_assert (LOCATION_LOCUS (loc) == UNKNOWN_LOCATION - || LOCATION_LOCUS (loc) == BUILTINS_LOCATION); - return false; - } + if (xloc.line == 0 + && (LOCATION_LOCUS (loc) == UNKNOWN_LOCATION + || LOCATION_LOCUS (loc) == BUILTINS_LOCATION)) + return false; + filename = xloc.file; linenum = xloc.line; columnnum = xloc.column; diff --git a/gcc/testsuite/gcc.dg/debug/pr97714.c b/gcc/testsuite/gcc.dg/debug/pr97714.c new file mode 100644 index 0000000000000..dba17831d6943 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr97714.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O -g" } */ + +void +function () +{ + if (0) + { +#line 0 "whatever" + } +}