This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix LTO streaming of BUILTINS_LOCATION
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Richard Biener <rguenther at suse dot de>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 9 Jun 2015 00:11:55 +0200
- Subject: Re: Fix LTO streaming of BUILTINS_LOCATION
- Authentication-results: sourceware.org; auth=none
- References: <20150608041810 dot GB35779 at kam dot mff dot cuni dot cz> <alpine dot LSU dot 2 dot 11 dot 1506080926360 dot 30088 at zhemvz dot fhfr dot qr> <20150608073552 dot GA36878 at kam dot mff dot cuni dot cz> <alpine dot LSU dot 2 dot 11 dot 1506080936250 dot 30088 at zhemvz dot fhfr dot qr>
>
> Yeah, I think streaming all locations up to RESERVED_LOCATION_COUNT
> literally is more robust. Thus do
>
> bp_pack_int_in_range (bp, 0, RESERVED_LOCATION_COUNT,
> loc < RESERVED_LOCATION_COUNT ? loc :
> RESERVED_LOCATION_COUNT);
> if (loc < RESERVED_LOCATION_COUNT)
> return;
Yep, I did that in meantime (did not notice we have RESERVED_LOCATION_COUNT)
This is what I commited.
2015-06-08 Jan Hubicka <hubicka@ucw.cz>
* lto-streamer-out.c (lto_output_location): Stream
reserved locations correctly.
* lto-streamer-in.c (lto_output_location): Likewise.
Index: lto-streamer-out.c
===================================================================
--- lto-streamer-out.c (revision 224248)
+++ lto-streamer-out.c (working copy)
@@ -202,8 +202,10 @@
expanded_location xloc;
loc = LOCATION_LOCUS (loc);
- bp_pack_value (bp, loc == UNKNOWN_LOCATION, 1);
- if (loc == UNKNOWN_LOCATION)
+ bp_pack_int_in_range (bp, 0, RESERVED_LOCATION_COUNT,
+ loc < RESERVED_LOCATION_COUNT
+ ? loc : RESERVED_LOCATION_COUNT);
+ if (loc < RESERVED_LOCATION_COUNT)
return;
xloc = expand_location (loc);
Index: lto-streamer-in.c
===================================================================
--- lto-streamer-in.c (revision 224248)
+++ lto-streamer-in.c (working copy)
@@ -278,13 +278,14 @@
gcc_assert (current_cache == this);
- if (bp_unpack_value (bp, 1))
- {
- *loc = UNKNOWN_LOCATION;
- return;
- }
- *loc = BUILTINS_LOCATION + 1;
+ *loc = bp_unpack_int_in_range (bp, "location", 0, RESERVED_LOCATION_COUNT);
+ if (*loc < RESERVED_LOCATION_COUNT)
+ return;
+
+ /* Keep value RESERVED_LOCATION_COUNT in *loc as linemap lookups will
+ ICE on it. */
+
file_change = bp_unpack_value (bp, 1);
line_change = bp_unpack_value (bp, 1);
column_change = bp_unpack_value (bp, 1);