]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
preprocessor/100142 - revert unwanted change in last commit
authorRichard Biener <rguenther@suse.de>
Mon, 19 Apr 2021 08:07:35 +0000 (10:07 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 19 Apr 2021 12:43:39 +0000 (14:43 +0200)
This reverts a s/column_offset/column/ change in the fix for PR99446.

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/testsuite/
* gcc.dg/pr100142.c: New testcase.
* g++.dg/diagnostic/pr72803.C: Revert last change.

gcc/testsuite/g++.dg/diagnostic/pr72803.C
gcc/testsuite/gcc.dg/pr100142.c [new file with mode: 0644]
libcpp/line-map.c

index ca522b74bad243241a41b428b3e0f6356a91b531..0a9a390b9c33d523d49777b31b1dfaf98299c3e3 100644 (file)
@@ -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 (file)
index 0000000..aec146c
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-fpreprocessed" } */
+
+void
+foo (void)
+{
+  assert (1); /* { dg-warning "implicit" } */
+}
index 2f5e44447d24e9cc3fd2f314d5825d0fa16ad028..a03d6760a8e62a787bece6059fe9d5d22a59d144 100644 (file)
@@ -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.  */