https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86872
David Malcolm <dmalcolm at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dmalcolm at gcc dot gnu.org --- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> --- (In reply to H.J. Lu from comment #0) > On x86-64, r263300 gave Annotating it with the code in question: > In function ‘gimple_simplify_32’: > lto1: internal compiler error: in linemap_check_ordinary, at > libcpp/include/line-map.h:587 > 0x5e2991 ??? > ../../src-trunk/libcpp/include/line-map.h:587 linemap_assert (MAP_ORDINARY_P (map)); > 0x93aeae ??? > ../../src-trunk/libcpp/line-map.c:754 In linemap_line_start: /* 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 || last_line != ORDINARY_MAP_STARTING_LINE_NUMBER (map) || SOURCE_COLUMN (map, highest) >= (1U << (column_bits - range_bits)) || range_bits < map->m_range_bits) map = linemap_check_ordinary (const_cast <line_map *> (linemap_add (set, LC_RENAME, ORDINARY_MAP_IN_SYSTEM_HEADER_P (map), ORDINARY_MAP_FILE_NAME (map), to_line))); > 0x1d653e2 ??? > ../../src-trunk/gcc/lto-streamer-in.c:194 in lto_location_cache::apply_location_cache (): linemap_line_start (line_table, loc.line, max + 1); > 0x1d6661f ??? > ../../src-trunk/gcc/lto-streamer-in.c:304 in stream_input_location_now: data_in->location_cache.apply_location_cache (); > 0xbc5f88 ??? > ../../src-trunk/gcc/gimple-streamer-in.c:111 in input_gimple_stmt: /* Read location information. Caching here makes no sense until streamer cache can handle the following gimple_set_block. */ gimple_set_location (stmt, stream_input_location_now (&bp, data_in)); (etc) linemap_add can return NULL with LC_LEAVE, but we have LC_RENAME. The return value ("map") comes from: linemap_assert (reason != LC_ENTER_MACRO); line_map_ordinary *map = linemap_check_ordinary (new_linemap (set, start_location)); map->reason = reason; linemap_check_ordinary is: linemap_assert (MAP_ORDINARY_P (map)); which, in turn is: inline bool MAP_ORDINARY_P (const line_map *map) { return map->start_location < LINE_MAP_MAX_LOCATION; } map->start_location shouldn't be able to change. I believe what's happened is that: to_line >= LINE_MAP_MAX_LOCATION within linemap_line_start. That way, linemap_add would (unexpectedly) create a macro map, rather than an ordinary map. Presumably we need some kind of overflow handling here (assuming that the above correctly characterizes the cause of the crash). Also, it seems bad to be running out of location_t values. We probably should double-check that we're packing things efficiently.