aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/g++.dg/plugin/location-overflow-test-pr96391.c12
-rw-r--r--gcc/testsuite/g++.dg/plugin/plugin.exp2
-rw-r--r--libcpp/line-map.c3
3 files changed, 16 insertions, 1 deletions
diff --git a/gcc/testsuite/g++.dg/plugin/location-overflow-test-pr96391.c b/gcc/testsuite/g++.dg/plugin/location-overflow-test-pr96391.c
new file mode 100644
index 0000000..1816961
--- /dev/null
+++ b/gcc/testsuite/g++.dg/plugin/location-overflow-test-pr96391.c
@@ -0,0 +1,12 @@
+/* { dg-options "-fplugin-arg-location_overflow_plugin-value=0x60000001" } */
+
+/* We use location_overflow_plugin.c, which injects the case that location_t
+ values have exceeded LINE_MAP_MAX_LOCATION_WITH_COLS, and hence no column
+ numbers are available. */
+
+/* Verify that we're in column-less mode. */
+extern unknown_type test; /* { dg-error "-:'unknown_type' does not name a type" } */
+
+#define CONST const
+#define VOID void
+typedef CONST VOID *PCVOID;
diff --git a/gcc/testsuite/g++.dg/plugin/plugin.exp b/gcc/testsuite/g++.dg/plugin/plugin.exp
index 80c5355..5cd4b4b 100644
--- a/gcc/testsuite/g++.dg/plugin/plugin.exp
+++ b/gcc/testsuite/g++.dg/plugin/plugin.exp
@@ -72,6 +72,8 @@ set plugin_test_list [list \
../../gcc.dg/plugin/diagnostic-test-string-literals-2.c \
../../gcc.dg/plugin/diagnostic-test-string-literals-3.c \
../../gcc.dg/plugin/diagnostic-test-string-literals-4.c } \
+ { ../../gcc.dg/plugin/location_overflow_plugin.c \
+ location-overflow-test-pr96391.c } \
{ show_template_tree_color_plugin.c \
show-template-tree-color.C \
show-template-tree-color-labels.C \
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index 2432cd5..cccacf2 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -1417,7 +1417,8 @@ linemap_compare_locations (line_maps *set,
if (l0 == l1
&& pre_virtual_p
- && post_virtual_p)
+ && post_virtual_p
+ && l0 <= LINE_MAP_MAX_LOCATION_WITH_COLS)
{
/* So pre and post represent two tokens that are present in a
same macro expansion. Let's see if the token for pre was