public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] preprocessor/100142  - revert unwanted change in last commit
@ 2021-04-19  9:26 Richard Biener
  2021-04-19 10:06 ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2021-04-19  9:26 UTC (permalink / raw)
  To: gcc-patches; +Cc: jakub, nathan

This reverts a s/column_offset/column/ change in the fix for PR99446.

This time with testcase included in the patch and the necessary reversion
of the testsuite change of the offending rev.

Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?

Thanks,
Richard.

2021-04-19  Richard Biener  <rguenther@suse.de>

	PR preprocessor/100142
libcpp/
	* line-map.c (linemap_position_for_loc_and_offset): Revert
	unintended s/column_offset/column/ change.

	* gcc.dg/pr100142.c: New testcase.
	* g++.dg/diagnostic/pr72803.C: Revert last change.
---
 gcc/testsuite/g++.dg/diagnostic/pr72803.C | 5 ++---
 gcc/testsuite/gcc.dg/pr100142.c           | 8 ++++++++
 libcpp/line-map.c                         | 2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/pr100142.c

diff --git a/gcc/testsuite/g++.dg/diagnostic/pr72803.C b/gcc/testsuite/g++.dg/diagnostic/pr72803.C
index ca522b74bad..0a9a390b9c3 100644
--- a/gcc/testsuite/g++.dg/diagnostic/pr72803.C
+++ b/gcc/testsuite/g++.dg/diagnostic/pr72803.C
@@ -5,6 +5,5 @@ class test {
 // The line directive appears to be necessary to trigger the ICE
 // { dg-error "style of line directive is a GCC extension" "" { target *-*-* } .-2 }
 
-/* Verify that we get the best line and column for the diagnostic.
-   512 is not representable in the line-maps created for this test.  */
-// { dg-error "511: expected .;. after class definition" "" { target *-*-* } 3 }
+/* Verify that we get the correct line and column for the diagnostic.  */
+// { dg-error "512: expected .;. after class definition" "" { target *-*-* } 3 }
diff --git a/gcc/testsuite/gcc.dg/pr100142.c b/gcc/testsuite/gcc.dg/pr100142.c
new file mode 100644
index 00000000000..aec146cb0a9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr100142.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-fpreprocessed" } */
+
+void
+foo (void)
+{
+  assert (1); /* { dg-warning "implicit" } */
+}
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index 2f5e44447d2..a03d6760a8e 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -982,7 +982,7 @@ linemap_position_for_loc_and_offset (line_maps *set,
      the next line map of the set.  Otherwise, we try to encode the
      location in the next map.  */
   for (; map != LINEMAPS_LAST_ORDINARY_MAP (set)
-	 && (loc + (column << map->m_range_bits)
+	 && (loc + (column_offset << map->m_range_bits)
 	     >= MAP_START_LOCATION (map + 1)); map++)
     /* If the next map is a different file, or starts in a higher line, we
        cannot encode the location there.  */
-- 
2.26.2

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

* Re: [PATCH] preprocessor/100142  - revert unwanted change in last commit
  2021-04-19  9:26 [PATCH] preprocessor/100142 - revert unwanted change in last commit Richard Biener
@ 2021-04-19 10:06 ` Jakub Jelinek
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Jelinek @ 2021-04-19 10:06 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches, nathan

On Mon, Apr 19, 2021 at 11:26:04AM +0200, Richard Biener wrote:
> This reverts a s/column_offset/column/ change in the fix for PR99446.
> 
> This time with testcase included in the patch and the necessary reversion
> of the testsuite change of the offending rev.
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?
> 
> Thanks,
> Richard.
> 
> 2021-04-19  Richard Biener  <rguenther@suse.de>
> 
> 	PR preprocessor/100142
> libcpp/
> 	* line-map.c (linemap_position_for_loc_and_offset): Revert
> 	unintended s/column_offset/column/ change.
> 
> 	* gcc.dg/pr100142.c: New testcase.
> 	* g++.dg/diagnostic/pr72803.C: Revert last change.

LGTM, but please give Nathan 2-3 hours to chime in if the change was
intentional.

	Jakub


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

* [PATCH] preprocessor/100142  - revert unwanted change in last commit
@ 2021-04-19  8:10 Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2021-04-19  8:10 UTC (permalink / raw)
  To: gcc-patches; +Cc: jakub, nathan

This reverts a s/column_offset/column/ change in the fix for PR99446.

Boostrapped on x86_64-unknown-linux-gnu, testing in progress.

OK for trunk?

Thanks,
Richard.

2021-04-19  Richard Biener  <rguenther@suse.de>

	PR preprocessor/100142
libcpp/
	* line-map.c (linemap_position_for_loc_and_offset): Revert
	unintended s/column_offset/column/ change.

	* gcc.dg/pr100142.c: New testcase.
---
 libcpp/line-map.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index 2f5e44447d2..a03d6760a8e 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -982,7 +982,7 @@ linemap_position_for_loc_and_offset (line_maps *set,
      the next line map of the set.  Otherwise, we try to encode the
      location in the next map.  */
   for (; map != LINEMAPS_LAST_ORDINARY_MAP (set)
-	 && (loc + (column << map->m_range_bits)
+	 && (loc + (column_offset << map->m_range_bits)
 	     >= MAP_START_LOCATION (map + 1)); map++)
     /* If the next map is a different file, or starts in a higher line, we
        cannot encode the location there.  */
-- 
2.26.2

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

end of thread, other threads:[~2021-04-19 10:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-19  9:26 [PATCH] preprocessor/100142 - revert unwanted change in last commit Richard Biener
2021-04-19 10:06 ` Jakub Jelinek
  -- strict thread matches above, loose matches on Subject: below --
2021-04-19  8:10 Richard Biener

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).