On Wed, 8 Jul 2015, Jakub Jelinek wrote:

> On Wed, Jul 08, 2015 at 01:58:38PM +0200, Richard Biener wrote:
> > 
> > The following fixes #pragma pack effect leaking to all types built
> > from the middle-end (so possibly even vector types built by the
> > vectorizer?).  The PR in question is about gcov_info_type where
> > layout is affected and inconsistency between that and the libgcov.a
> > copy causes libgcov to crash.
> > 
> > As the way to communicate #pragma pack to stor-layout.c is already
> > a hack I couldn't think of a better solution like that below.
> > 
> > Bootstrap and regtest running on x86_64-unknown-linux-gnu.
> > 
> > Ok?
> > 
> > Thanks,
> > Richard.
> > 
> > 2015-07-08  Richard Biener  <rguent...@suse.de>
> > 
> >     * stor-layout.h (reset_maximum_field_alignment): Declare.
> >     * stor-layout.c (reset_maximum_field_alignment): New function.
> >     * toplev.c: Include stor-layout.h.
> >     (compile_file): Reset maximum_field_alignment after parsing.
> 
> toplev.c already sets maximum_field_alignment directly, and to a different
> value:
> maximum_field_alignment = initial_max_fld_align * BITS_PER_UNIT;
> so I'm not sure you need a new function.  And, shouldn't you reset to
> maximum_field_alignment = initial_max_fld_align * BITS_PER_UNIT;
> ?  -fpack-struct= is an ABI changing option, so IMHO it should affect
> even gcov_info_type etc.

That would support the 2nd patch variant.  Note that -fpack-struct
can be specified in optimize attributes...

Richard.

-- 
Richard Biener <rguent...@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Dilip Upmanyu, Graham 
Norton, HRB 21284 (AG Nuernberg)

Reply via email to