> The problem is that linemap_location_from_macro_expansion_p will > always return true if locus has discriminator. And in linemap_lookup, > this will lead to call linemap_macro_map_lookup, in which there is an > assertion: > > linemap_assert (line >= LINEMAPS_MACRO_LOWEST_LOCATION (set)); > > However, line is actually not a macro location.
That sounds like we're leaking a discriminator location into the linemap code. Before you can call linemap_location_from_macro_expansion_p, you need to do this (as in expand_location_1): /* If LOC describes a location with a discriminator, extract the discriminator and map it to the real location. */ if (min_discriminator_location != UNKNOWN_LOCATION && loc >= min_discriminator_location && loc < next_discriminator_location) loc = map_discriminator_location (loc); -cary