https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65536

--- Comment #22 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Jan Hubicka from comment #20)
> It seems that manuel just commented out the actual insertion to linemap,
> columns are still streamed and ignored.
> 
> Doing so will clearly make ODR waring more difficult to follow, so perhaps
> we could try to go for it only after reading sufficiently large portion of
> program?

The problem is that by creating the line_table with physical locations
out-of-order, LTO is

1) creating a lot of maps, even for small column changes. Thus, consuming a lot
of extra memory.

2) increasing location_t values rapidly, thus probably triggering an overflow. 

The line-maps.c code already dynamically disables column numbers when
location_t values get very large (I think this is the reason that there are no
column numbers in the examples you show). If the location_t numbers get even
larger, it will start returning UNKNOWN_LOCATION. Now I think that if you see
wrong line numbers is most probably because of wrong location info in the
front-ends, not because linemaps overflowed.

There is also some mismatch between the limits used by linemap_line_start():

      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)
            return 0; /* Give up completely  and return UKNOWN_LOCATION */
          column_bits = 0;
        }

and the limits used by linemap_position_for_column:

  if (to_column >= set->max_column_hint)
    {
      if (r >= 0xC000000 || to_column > LINE_MAP_MAX_COLUMN_NUMBER)
        {
          /* Running low on source_locations - disable column numbers.  */
          return r;
        }
      else
        {
          struct line_map *map = LINEMAPS_LAST_ORDINARY_MAP (set);
          r = linemap_line_start (set, SOURCE_LINE (map, r), to_column + 50);
        }
    }

I'm not sure if the gap may lead to some problem, but it seems unlikely. In the
worst case, it should return 0, thus UNKNOWN_LOCATION (I can see some instances
of this in your examples).

Reply via email to