https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94311
--- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
One possible way at the libcpp side is to make sure we don't deplete the
location_t stuff too much once we are above highest >
LINE_MAP_MAX_LOCATION_WITH_COLS. I mean, the comment above this if block says:
/* Allocate the new line_map. However, if the current map only has a
single line we can sometimes just increase its column_bits instead. */
and with these > 0x60000000 locations, column_bits and range_bits is 0 anyway
and in that case we are not going to increase its column_bits.
Now, I've bootstrapped a slightly different version overnight, which instead
had || column_bits == 0, and that regressed the g++.dg/diagnostic/pr77949.C
testcase which has a 4KB+ line and thus disables columns and expects no fixit
hint. Or perhaps use || (highest > ... && (to_line -
ORDINARY_MAP_STARTING_LINE_NUMBER (map)) > 100) or something similar, allow
some growth, but not unlimited? David, your thoughts on this?
2020-09-02 Jakub Jelinek <[email protected]>
PR lto/94311
* line-map.c (linemap_line_start): For single-line map don't try
to extend it if highest > LINE_MAP_MAX_LOCATION_WITH_COLS.
--- libcpp/line-map.c.jj 2020-07-28 15:39:10.127754591 +0200
+++ libcpp/line-map.c 2020-09-02 11:08:50.421816848 +0200
@@ -742,7 +742,8 @@ linemap_line_start (line_maps *set, line
(to_line - ORDINARY_MAP_STARTING_LINE_NUMBER (map))
>= (((uint64_t) 1)
<< (CHAR_BIT * sizeof (linenum_type) - column_bits)))
- || range_bits < map->m_range_bits)
+ || range_bits < map->m_range_bits
+ || highest > LINE_MAP_MAX_LOCATION_WITH_COLS)
map = linemap_check_ordinary
(const_cast <line_map *>
(linemap_add (set, LC_RENAME,