summaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2019-10-04 19:08:09 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2019-10-04 19:08:09 +0000
commit924b92765863cfedb1955c712cf12d1ec56d229b (patch)
tree7a50d295c74138895fa2da47e5d0722521ff3b93 /libcpp
parent2066f7951cc4f0b23ddff5abfd2ad2ea4ee90fff (diff)
downloadgcc-924b92765863cfedb1955c712cf12d1ec56d229b.tar.gz
[preprocessor/91991] column location overflow
https://gcc.gnu.org/ml/gcc-patches/2019-10/msg00371.html PR preprocessor/91991 * line-map.c (linemap_line_start): Clear max_column_hint if we run out of locations. From-SVN: r276596
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog6
-rw-r--r--libcpp/line-map.c8
2 files changed, 12 insertions, 2 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index e13ff1dbf1b..f3237fbd38f 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,9 @@
+2019-10-04 Nathan Sidwell <nathan@acm.org>
+
+ PR preprocessor/91991
+ * line-map.c (linemap_line_start): Clear max_column_hint if we run
+ out of locations.
+
2019-10-02 Richard Biener <rguenther@suse.de>
* internal.h (enum include_type): Remove trailing comma.
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index d6924eb3e78..feeb7480876 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -717,11 +717,11 @@ linemap_line_start (line_maps *set, linenum_type to_line,
/* If the column number is ridiculous or we've allocated a huge
number of location_ts, give up on column numbers
(and on packed ranges). */
- max_column_hint = 0;
+ max_column_hint = 1;
column_bits = 0;
range_bits = 0;
if (highest >= LINE_MAP_MAX_LOCATION)
- return 0;
+ goto overflowed;
}
else
{
@@ -735,6 +735,7 @@ linemap_line_start (line_maps *set, linenum_type to_line,
max_column_hint = 1U << column_bits;
column_bits += range_bits;
}
+
/* Allocate the new line_map. However, if the current map only has a
single line we can sometimes just increase its column_bits instead. */
if (line_delta < 0
@@ -765,8 +766,11 @@ linemap_line_start (line_maps *set, linenum_type to_line,
macro tokens. */
if (r >= LINE_MAP_MAX_LOCATION)
{
+ overflowed:
/* Remember we overflowed. */
set->highest_line = set->highest_location = LINE_MAP_MAX_LOCATION - 1;
+ /* No column numbers! */
+ set->max_column_hint = 1;
return 0;
}