This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [GOOGLE] Updates highest_location when updating next_discriminator_location
- From: Cary Coutant <ccoutant at google dot com>
- To: Dehao Chen <dehao at google dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, David Li <davidxl at google dot com>
- Date: Tue, 13 May 2014 10:04:48 -0700
- Subject: Re: [GOOGLE] Updates highest_location when updating next_discriminator_location
- Authentication-results: sourceware.org; auth=none
- References: <CAO2gOZUow-9Dgt6qDwZSeuJw1Z+5=2PjkmPsoQcrWWsAoFZrBg at mail dot gmail dot com> <CAHACq4qfeQX=zcNSgzg8XGE1216BVi73HGmYyfYp4_ro1vYtvg at mail dot gmail dot com> <CAO2gOZXK6ORF2qUiT055AfUt0nSnZZYb_1JiXjwwqV6mByHcNA at mail dot gmail dot com>
> 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