https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65536
--- Comment #18 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- (In reply to Manuel López-Ibáñez from comment #17) > Something like this (not even compiled): This version compiles Index: src/libcpp/include/line-map.h =================================================================== --- src/libcpp/include/line-map.h (revision 221557) +++ src/libcpp/include/line-map.h (working copy) @@ -88,10 +88,14 @@ struct GTY(()) line_map_ordinary { /* This is the highest possible source location encoded within an ordinary or macro map. */ #define MAX_SOURCE_LOCATION 0x7FFFFFFF +/* We do not track column numbers higher than this one. */ +#define LINE_MAP_MAX_COLUMN_NUMBER 100000 + + struct cpp_hashnode; /* A macro line map encodes location of tokens coming from a macro expansion. Index: src/libcpp/line-map.c =================================================================== --- src/libcpp/line-map.c (revision 221557) +++ src/libcpp/line-map.c (working copy) @@ -536,11 +536,12 @@ linemap_line_start (struct line_maps *se else max_column_hint = set->max_column_hint; if (add_map) { int column_bits; - if (max_column_hint > 100000 || highest > 0x60000000) + if (max_column_hint > LINE_MAP_MAX_COLUMN_NUMBER + || highest > 0x60000000) { /* If the column number is ridiculous or we've allocated a huge number of source_locations, give up on column numbers. */ max_column_hint = 0; if (highest > 0x70000000) @@ -598,11 +599,11 @@ linemap_position_for_column (struct line linemap_assert (!linemap_macro_expansion_map_p (LINEMAPS_LAST_ORDINARY_MAP (set))); if (to_column >= set->max_column_hint) { - if (r >= 0xC000000 || to_column > 100000) + if (r >= 0xC000000 || to_column > LINE_MAP_MAX_COLUMN_NUMBER) { /* Running low on source_locations - disable column numbers. */ return r; } else Index: src/gcc/lto-streamer-in.c =================================================================== --- src/gcc/lto-streamer-in.c (revision 221557) +++ src/gcc/lto-streamer-in.c (working copy) @@ -178,11 +178,10 @@ canon_file_name (const char *string) location_t lto_input_location (struct bitpack_d *bp, struct data_in *data_in) { static const char *current_file; static int current_line; - static int current_col; bool file_change, line_change, column_change; bool prev_file = current_file != NULL; if (bp_unpack_value (bp, 1)) return UNKNOWN_LOCATION; @@ -195,24 +194,31 @@ lto_input_location (struct bitpack_d *bp current_file = canon_file_name (bp_unpack_string (data_in, bp)); if (line_change) current_line = bp_unpack_var_len_unsigned (bp); + /* FIXME: Disable columns for now until streaming of locations is reimplemented. + static int current_col; if (column_change) current_col = bp_unpack_var_len_unsigned (bp); + */ - if (file_change) + if (file_change) { if (prev_file) - linemap_add (line_table, LC_LEAVE, false, NULL, 0); - - linemap_add (line_table, LC_ENTER, false, current_file, current_line); + linemap_add (line_table, LC_RENAME, false, current_file, current_line); + else + linemap_add (line_table, LC_ENTER, false, current_file, current_line); } else if (line_change) - linemap_line_start (line_table, current_line, current_col); - - return linemap_position_for_column (line_table, current_col); + /* Enough column_hint to disable columns */ + return linemap_line_start (line_table, current_line, + LINE_MAP_MAX_COLUMN_NUMBER + 1); + + /* Enough column_hint to disable columns */ + return linemap_position_for_column (line_table, + LINE_MAP_MAX_COLUMN_NUMBER + 1); } /* Read a reference to a tree node from DATA_IN using input block IB. TAG is the expected node that should be found in IB, if TAG belongs