This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR66805 - #pragma pack affecting gcov_info_type layout


On Wed, 8 Jul 2015, 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?

Ok, so I found initial_max_fld_align and instead propose the following
simpler.

2015-07-08  Richard Biener  <rguenther@suse.de>

	* toplev.c (compile_file): Reset maximum_field_alignment after parsing.

Index: gcc/toplev.c
===================================================================
--- gcc/toplev.c	(revision 225534)
+++ gcc/toplev.c	(working copy)
@@ -553,6 +553,11 @@ compile_file (void)
 
   if (flag_syntax_only || flag_wpa)
     return;
+ 
+  /* Reset maximum_field_alignment, it can be adjusted by #pragma pack
+     and this shouldn't influence any types built by the middle-end
+     from now on (like gcov_info_type).  */
+  maximum_field_alignment = initial_max_fld_align * BITS_PER_UNIT;
 
   ggc_protect_identifiers = false;
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]