public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] final: accept markers at line 0
@ 2020-12-18 14:46 Alexandre Oliva
  0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Oliva @ 2020-12-18 14:46 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:7473b8c0c5128e9316a4bc2b6698d4bc5fbdd337

commit 7473b8c0c5128e9316a4bc2b6698d4bc5fbdd337
Author: Alexandre Oliva <oliva@gnu.org>
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"
+    }
+}


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gcc(refs/users/aoliva/heads/testme)] final: accept markers at line 0
@ 2021-01-01  5:22 Alexandre Oliva
  0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Oliva @ 2021-01-01  5:22 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:de3e152eaf723eae262ec3391b9fa42b083d70f5

commit de3e152eaf723eae262ec3391b9fa42b083d70f5
Author: Alexandre Oliva <oliva@gnu.org>
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"
+    }
+}


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gcc(refs/users/aoliva/heads/testme)] final: accept markers at line 0
@ 2021-01-01  1:29 Alexandre Oliva
  0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Oliva @ 2021-01-01  1:29 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:2088c4669bbd193173177a757ad4e9245cafb3ac

commit 2088c4669bbd193173177a757ad4e9245cafb3ac
Author: Alexandre Oliva <oliva@gnu.org>
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"
+    }
+}


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gcc(refs/users/aoliva/heads/testme)] final: accept markers at line 0
@ 2020-12-25  1:45 Alexandre Oliva
  0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Oliva @ 2020-12-25  1:45 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:a2d338747aad26cef0f99cbf8799dbad4fc60e43

commit a2d338747aad26cef0f99cbf8799dbad4fc60e43
Author: Alexandre Oliva <oliva@gnu.org>
Date:   Thu Dec 24 22:43:00 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"
+    }
+}


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-01  5:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-18 14:46 [gcc(refs/users/aoliva/heads/testme)] final: accept markers at line 0 Alexandre Oliva
2020-12-25  1:45 Alexandre Oliva
2021-01-01  1:29 Alexandre Oliva
2021-01-01  5:22 Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).