This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR66805 - #pragma pack affecting gcov_info_type layout
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 8 Jul 2015 14:10:49 +0200
- Subject: Re: [PATCH] Fix PR66805 - #pragma pack affecting gcov_info_type layout
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1507081355000 dot 9923 at zhemvz dot fhfr dot qr>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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 <rguenther@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.
Jakub