This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [line-map patch] Better packing of maps


On 06/26/2018 03:31 PM, David Malcolm wrote:

Which assert are you referring to?

Hm, I think I may have been confused by the unsigned arithmetic check in:
  if (start_location <= set->highest_line
      || start_location > LINEMAPS_MACRO_LOWEST_LOCATION (set))
    /* We ran out of macro map space.   */
    return NULL;

It looks to me that the second condition can only be true with the first being false when the macro expansion is >= 2^32 tokens (give or take).

However, AFAICT, linemap_add doesn't check whether ordinary maps have run into the macro range:
  if (set->highest_location < LINE_MAP_MAX_LOCATION_WITH_COLS)
   {...}
  else
    start_location = set->highest_location + 1;

So if I'm reading the patch correctly, it introduces a new limit on how
big the macro maps can be: 0x10000000, hence about 268 million macro
argument expansions, I believe, before it will stop tracking macro
expansions.

You may be correct. The comment in line-map.h is unclear as to whether the LINE_MAP_MAX_SOURCE_LOCATION is a barrier for macros or not, it can be read either way.

Has this been smoketested on some very large C++ TUs?

No. The code bases available to me aren't gcc-trunk ready (I don't know if they contain single TUs so large).

nathan

--
Nathan Sidwell


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]