OK.
On Mon, Mar 6, 2017 at 3:56 PM, Jakub Jelinek <ja...@redhat.com> wrote: > Hi! > > gengtype.c considers all GC arrays with char/unsigned char/signed char > element type as strings, for which it computes size e.g. in gt_pch_note_object > using: > if (note_ptr_fn == gt_pch_p_S) > (*slot)->size = strlen ((const char *)obj) + 1; > else > (*slot)->size = ggc_get_size (obj); > That is really undesirable if the array is actually a collection of random > bytes rather than a NUL terminated string - then we can either compute > smaller size if there are zeros in the array, or if unlucky enough and there > are no zero bytes until end of mapped region, segfault. > > Fixed by avoiding the gt_pch_*_S handling by using void * pointer instead. > > Bootstrapped/regtested on x86_64-linux and i686-linux, and Rainer has kindly > tested it on sparc*-solaris* where it caused bootstrap issues. Ok for > trunk? > > 2017-03-06 Jakub Jelinek <ja...@redhat.com> > > PR c++/79821 > * dwarf2out.h (dw_vec_const): Change array type from unsigned char * > to void * for PCH reasons. > * dwarf2out.c (output_loc_operands, output_die): Cast > v.val_vec.array to unsigned char *. > > --- gcc/dwarf2out.h.jj 2017-01-01 12:45:37.000000000 +0100 > +++ gcc/dwarf2out.h 2017-03-06 12:13:48.809589411 +0100 > @@ -163,7 +163,7 @@ enum dw_val_class > /* Describe a floating point constant value, or a vector constant value. */ > > struct GTY(()) dw_vec_const { > - unsigned char * GTY((atomic)) array; > + void * GTY((atomic)) array; > unsigned length; > unsigned elt_size; > }; > --- gcc/dwarf2out.c.jj 2017-02-25 09:17:44.000000000 +0100 > +++ gcc/dwarf2out.c 2017-03-06 12:15:52.668958458 +0100 > @@ -2020,7 +2020,7 @@ output_loc_operands (dw_loc_descr_ref lo > elt_size /= 2; > len *= 2; > } > - for (i = 0, p = val2->v.val_vec.array; > + for (i = 0, p = (unsigned char *) val2->v.val_vec.array; > i < len; > i++, p += elt_size) > dw2_asm_output_data (elt_size, extract_int (p, elt_size), > @@ -2273,7 +2273,7 @@ output_loc_operands (dw_loc_descr_ref lo > elt_size /= 2; > len *= 2; > } > - for (i = 0, p = val2->v.val_vec.array; > + for (i = 0, p = (unsigned char *) val2->v.val_vec.array; > i < len; > i++, p += elt_size) > dw2_asm_output_data (elt_size, extract_int (p, elt_size), > @@ -10105,7 +10105,7 @@ output_die (dw_die_ref die) > elt_size /= 2; > len *= 2; > } > - for (i = 0, p = a->dw_attr_val.v.val_vec.array; > + for (i = 0, p = (unsigned char *) a->dw_attr_val.v.val_vec.array; > i < len; > i++, p += elt_size) > dw2_asm_output_data (elt_size, extract_int (p, elt_size), > > Jakub