On August 29, 2018 7:36:15 PM GMT+02:00, Nathan Sidwell <nat...@acm.org> wrote: >This defect concerns bitfield layout in the Microsoft ABI. This is a >fix for gcc-8. > >As well as MINGW targets, MS-ABI can be enabled on PowerPC & SuperH by >suitable use of attributes or options. > >When I folded TYPE_METHODS into TYPE_FIELDS, the 'am I the last field' >check of place_field could give a false positive in more cases. >Specifically if two bitfields were separated by a member function >declaration, they'd now be placed in separate allocation units. > >The place_field code was working under the assumption that the only >things on the TYPE_FIELDS list could be FIELD_DECLs possibly followed >by >TYPE_DECLs. That stopped being true some time ago, and as such we >already had a layout bug. > >But, it would be bad to make that particular ABI fix in a point >release, >so this patch just reverts the regression I caused. Sadly, because it >requires understanding TEMPLATE_DECL, we can't simply update >place_field. Instead I temporarily stitch out undesired DECLs around >the call to place_field. This seems the least intrusive, and happens >only when ms_bitfield_layout_p is in effect. > >I have manually checked the new testcase behaves the same in gcc-7 and >patched gcc-8 for an x86_64-mingw32 target. Liu Hao has verified that >the microsoft compiler gives the same results. > >I also attach a change to wwwdocs describing this change. > >Thoughts?
If it is that cumbersome to fix just the regression part we might also consider to fix the latent problem as well for GCC 8? We're already breaking the GCC 8 ABI and will be breaking the ABI again for GCC 9. Richard. > >nathan