From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id B28E6385702C; Fri, 18 Dec 2020 14:46:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B28E6385702C 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: ce8dcc9105cbd4043d575d8b2c91309a423951a9 X-Git-Newrev: 7473b8c0c5128e9316a4bc2b6698d4bc5fbdd337 Message-Id: <20201218144612.B28E6385702C@sourceware.org> Date: Fri, 18 Dec 2020 14:46:12 +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, 18 Dec 2020 14:46:12 -0000 https://gcc.gnu.org/g:7473b8c0c5128e9316a4bc2b6698d4bc5fbdd337 commit 7473b8c0c5128e9316a4bc2b6698d4bc5fbdd337 Author: Alexandre Oliva Date: Fri Dec 18 11:39:21 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" + } +}