diff options
author | Alexandre Oliva <oliva@gnu.org> | 2020-12-31 21:37:24 -0300 |
---|---|---|
committer | Alexandre Oliva <oliva@gnu.org> | 2021-01-09 00:09:02 -0300 |
commit | 57450da2fef3a32dc463b85e7b3d67f519b282cb (patch) | |
tree | 74308fefb6983b3a41a08405724cf6ad919d87f2 /gcc | |
parent | bf5cbb9edffc90eefba5c683dda0f1915e125018 (diff) | |
download | gcc-57450da2fef3a32dc463b85e7b3d67f519b282cb.zip gcc-57450da2fef3a32dc463b85e7b3d67f519b282cb.tar.gz gcc-57450da2fef3a32dc463b85e7b3d67f519b282cb.tar.bz2 |
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/debug/pr97714.c: New.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/final.c | 11 | ||||
-rw-r--r-- | 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 3eb779a..b037e07 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 0000000..dba1783 --- /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" + } +} |