This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PR c++/87137] GCC-8 Fix
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Nathan Sidwell <nathan at acm dot org>,GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Jason Merrill <jason at redhat dot com>,David Edelsohn <dje dot gcc at gmail dot com>,10walls at gmail dot com,Alexandre Oliva <aoliva at redhat dot com>,lh_mouse at 126 dot com
- Date: Wed, 29 Aug 2018 19:47:33 +0200
- Subject: Re: [PR c++/87137] GCC-8 Fix
- References: <1ae01cf1-3c10-84a8-418f-efa38ad78032@acm.org>
On August 29, 2018 7:36:15 PM GMT+02:00, Nathan Sidwell <nathan@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