On Wed, 23 Jan 2019, Richard Earnshaw (lists) wrote: > On 22/01/2019 15:46, Jakub Jelinek wrote: > > On Tue, Jan 22, 2019 at 02:43:38PM +0000, Richard Earnshaw (lists) wrote: > >> PR target/88469 > >> * profile-count.h (profile_count): Add dummy file with 64-bit alignment > >> on arm-based systems using gcc-6/7/8. > >> > > > >> diff --git a/gcc/profile-count.h b/gcc/profile-count.h > >> index c83fa3beb8f..ddfda2cddf4 100644 > >> --- a/gcc/profile-count.h > >> +++ b/gcc/profile-count.h > >> @@ -645,6 +645,12 @@ private: > >> > >> uint64_t m_val : n_bits; > >> enum profile_quality m_quality : 3; > >> +#if defined (__arm__) && (__GNUC__ >= 6 && __GNUC__ <= 8) > >> + /* Work-around for PR88469. A bug in the gcc-6/7/8 PCS layout code > >> + incorrectly detects the alignment of a structure where the only > >> + 64-bit aligned element is a bit-field. */ > >> + uint64_t m_force_alignment; > >> +#endif > > > > Adding another member is very costly. > > Can't you do something like: > > #if defined (__arm__) && (__GNUC__ >= 6 && __GNUC__ <= 8) > > #define UINT64_BITFIELD_ALIGN \ > > __attribute__((__aligned__ (__alignof__ (uint64_t)))) > > #else > > #define UINT64_BITFIELD_ALIGN > > #endif > > and use > > uint64_t m_val UINT64_BITFIELD_ALIGN : n_bits; > > ? > > > > Jakub > > > > Close. The alignment has to come before the m_val... > > > PR target/88469 > * profile-count.h (profile_count): Force alignment of > m_val when building on Arm-based systems with gcc-6/7/8. > > OK for trunk/gcc-8?
+#define UINT64_BITFIELD_ALIGN +#endif + uint64_t UINT64_BITFIELD_ALIGN m_val : n_bits; enum profile_quality m_quality : 3; - avoid the stray vertical whitespace change and please #undef UINT64_BITFIELD_ALIGN after use. OK with that change. Richard.