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

--- Comment #37 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Jan Hubicka from comment #36)
> Here we seem to sometimes affect ORDINARY_MAP_NUMBER_OF_COLUMN_BITS of an
> existing line map.  How that can work?  We already have locators that do
> depends on the previous COLUMN_BITS value.

The condition is checking that this map has more than one line

          || last_line != ORDINARY_MAP_STARTING_LINE_NUMBER (map)

or we have assigned a location_t for a column larger than what we can address
if we reduce the column bits of this map

          || SOURCE_COLUMN (map, highest) >= (1U << column_bits))

If none of those are true, we can reduce the column bits without affecting an
already assigned columns, because the location_t value for those columns is
simply the location_t value of the line + column.


> I would expect the ORDINARY_MPA_NUMBER_OF_COLUMN_BITS set to be part of the
> conditional and the computation bellow use map's column_bits.
> Also I think the conditoinal guarding creation may want to check how far r
> will be bumped and force creation when we are running short of locators.

I don't understand. Which conditional? Force creating of what?

In fact, when we are running short of locators, 

      || (highest > 0x60000000
          && (set->max_column_hint || highest > 0x70000000)))

you see that add_map=true; then later

      if (max_column_hint > 100000 || 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;
          column_bits = 0; 

which will give up on column numbers and force creating a new map that does not
track columns (since SOURCE_COLUMN (map, highest) >= (1U << column_bits) will
be always true), or if we are really short on source_locations, then give up
completely and return UNKNOWN_LOCATION.

But now that I think about it. If linemap_star_line returns UNKNOWN_LOCATION
because set->highest_location > 0x70000000, but then you call
linemap_position_for_column and set->highest_location < 0xC0000000, then
linemap_line_start will return 0 again, thus linemap_position_for_column will
return 0 + to_column and that would be bad. Can you follow me? Do you also see
a potential bug there?

Reply via email to