From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id B3FBE3858D29; Fri, 1 Jan 2021 05:22:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3FBE3858D29 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] final: accept markers at line 0 X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/users/aoliva/heads/testme X-Git-Oldrev: cc55c5862ee5b2ef4d86065b5329a91d48563019 X-Git-Newrev: de3e152eaf723eae262ec3391b9fa42b083d70f5 Message-Id: <20210101052216.B3FBE3858D29@sourceware.org> Date: Fri, 1 Jan 2021 05:22:16 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jan 2021 05:22:16 -0000 https://gcc.gnu.org/g:de3e152eaf723eae262ec3391b9fa42b083d70f5 commit de3e152eaf723eae262ec3391b9fa42b083d70f5 Author: Alexandre Oliva Date: Thu Dec 31 21:37:24 2020 -0300 final: accept markers at line 0 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. 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. Diff: --- gcc/final.c | 11 +++++------ gcc/testsuite/gcc.dg/debug/pr97714.c | 11 +++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/gcc/final.c b/gcc/final.c index fc9a05e335f..45f7f39f088 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 00000000000..dba17831d69 --- /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" + } +}