This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++] small PATCH to layout_class_type wrt large bit-fields
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: "Eric M. Christopher" <echristo at redhat dot com>, Mark Mitchell <mark at codesourcery dot com>
- Date: Fri, 17 Oct 2003 16:53:36 -0400
- Subject: [C++] small PATCH to layout_class_type wrt large bit-fields
Eric was recently having problems on the frv with Mark's April change
which started to set DECL_CONTEXT on the extra padding field added to
handle overlong bit-fields.
Eric recently changed frv.c to work around this, but I think that change is
wrong: Eric, the padding field is separate from the field which contains
the actual value, and could still be smaller than the type if the bitfield
is only a few bits larger than the type.
Setting DECL_ARTIFICIAL on the padding field is entirely appropriate, and
is simple to check; there shouldn't be any other artificial bit-fields in a
class.
Tested x86_64-pc-linux-gnu, applied to trunk.
2003-10-17 Jason Merrill <jason@redhat.com>
* class.c (layout_class_type): Set DECL_ARTIFICIAL on padding
field.
*** ./cp/class.c.~1~ 2003-10-15 17:21:18.000000000 -0400
--- ./cp/class.c 2003-10-17 14:12:14.000000000 -0400
*************** layout_class_type (tree t, tree *virtual
*** 4815,4820 ****
--- 4815,4821 ----
DECL_BIT_FIELD (padding_field) = 1;
DECL_SIZE (padding_field) = padding;
DECL_CONTEXT (padding_field) = t;
+ DECL_ARTIFICIAL (padding_field) = 1;
layout_nonempty_base_or_field (rli, padding_field,
NULL_TREE,
empty_base_offsets);