[PR c++/87137] GCC-8 Fix

2018-08-29 Thread Nathan Sidwell
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

Re: [PR c++/87137] GCC-8 Fix

2018-08-29 Thread Richard Biener
On August 29, 2018 7:36:15 PM GMT+02:00, Nathan Sidwell 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 in

Re: [PR c++/87137] GCC-8 Fix

2018-08-29 Thread Jakub Jelinek
On Wed, Aug 29, 2018 at 01:36:15PM -0400, Nathan Sidwell wrote: > --- gcc/cp/class.c(revision 263959) > +++ gcc/cp/class.c(working copy) > @@ -4041,6 +4041,32 @@ layout_nonempty_base_or_field (record_la >field_p = true; > } > > + /* PR c++/87137 When ms_bitfield_layout_p is

Re: [PR c++/87137] GCC-8 Fix

2018-08-29 Thread Liu Hao
在 2018-08-30 01:36, Nathan Sidwell 写道: 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 unde

Re: [PR c++/87137] GCC-8 Fix

2018-08-30 Thread Nathan Sidwell
On 08/29/2018 11:06 PM, Liu Hao wrote: It is strictly an ABI break but I doubt whether code in real world that got broken by this bug ever exists. Usually when people expect consecutive bitfields to be packed into a single word they wouldn't put irrelevant declarations between them. You're p

Re: [PR c++/87137] GCC-8 Fix

2018-08-30 Thread JonY
On 08/30/2018 11:59 AM, Nathan Sidwell wrote: > On 08/29/2018 11:06 PM, Liu Hao wrote: > >> It is strictly an ABI break but I doubt whether code in real world >> that got broken by this bug ever exists. Usually when people expect >> consecutive bitfields to be packed into a single word they wouldn

Re: [PR c++/87137] GCC-8 Fix

2018-08-31 Thread Richard Biener
On Thu, Aug 30, 2018 at 5:09 PM JonY <10wa...@gmail.com> wrote: > > On 08/30/2018 11:59 AM, Nathan Sidwell wrote: > > On 08/29/2018 11:06 PM, Liu Hao wrote: > > > >> It is strictly an ABI break but I doubt whether code in real world > >> that got broken by this bug ever exists. Usually when people

Re: [PR c++/87137] GCC-8 Fix

2018-08-31 Thread Michael Matz
Hi, On Thu, 30 Aug 2018, Nathan Sidwell wrote: > > struct foo > >   { > >     unsigned a : 21; > >     union x1 { char x; }; > >     unsigned b : 11; > >     union x1 u; > >   }; > > (for C++) this happens to be a case we already get right. I think > that'd be a C vendor extension, I don

Re: [PR c++/87137] GCC-8 Fix

2018-08-31 Thread Jason Merrill
On Fri, Aug 31, 2018 at 10:35 AM, Michael Matz wrote: > Hi, > > On Thu, 30 Aug 2018, Nathan Sidwell wrote: > >> > struct foo >> >{ >> > unsigned a : 21; >> > union x1 { char x; }; >> > unsigned b : 11; >> > union x1 u; >> >}; >> >> (for C++) this happens to be a case we

Re: [PR c++/87137] GCC-8 Fix

2018-08-31 Thread Joseph Myers
On Fri, 31 Aug 2018, Jason Merrill wrote: > > Anonymous structures and unions are in C11 (and before that a widely > > accepted extension). > > This isn't an anonymous union, it's named "x1". I don't think that > line declares a field in C, either. Indeed, the case where the field has a tag is