aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2003-04-29 21:28:41 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2003-04-29 21:28:41 +0000
commit555456b175d649bfd04a906e4d32b9329f35db4c (patch)
treebd8ac54fa0e75ebd131c2a5b7f7640db81897cd8 /gcc/cp
parentf4ddb75bb3980dc9c331ddb0dbab5704920d3742 (diff)
downloadgcc-555456b175d649bfd04a906e4d32b9329f35db4c.zip
gcc-555456b175d649bfd04a906e4d32b9329f35db4c.tar.gz
gcc-555456b175d649bfd04a906e4d32b9329f35db4c.tar.bz2
re PR c++/10549 (ICE in store_bit_field on bitfields that exceed the precision of the declared type.)
PR c++/10549 * class.c (layout_class_type): Mark overlong bitfields as having the maximum size permitted by their type, after layout. PR c++/10549 * g++.dg/other/bitfield1.C: New test. From-SVN: r66257
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/class.c20
2 files changed, 16 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3a65705..3da0676 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2003-04-29 Mark Mitchell <mark@codesourcery.com>
+ PR c++/10549
+ * class.c (layout_class_type): Mark overlong bitfields as having
+ the maximum size permitted by their type, after layout.
+
PR c++/10527
* error.c (dump_expr): Correctly handling of NEW_EXPR.4
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 33ece0d..7dbfa76 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -4724,7 +4724,6 @@ layout_class_type (tree t, tree *virtuals_p)
{
tree type;
tree padding;
- bool was_unnamed_p = false;
/* We still pass things that aren't non-static data members to
the back-end, in case it wants to do something with them. */
@@ -4758,6 +4757,7 @@ layout_class_type (tree t, tree *virtuals_p)
{
integer_type_kind itk;
tree integer_type;
+ bool was_unnamed_p = false;
/* We must allocate the bits as if suitably aligned for the
longest integer type that fits in this many bits. type
of the field. Then, we are supposed to use the left over
@@ -4809,14 +4809,18 @@ layout_class_type (tree t, tree *virtuals_p)
DECL_SIZE (field) = TYPE_SIZE (integer_type);
DECL_ALIGN (field) = TYPE_ALIGN (integer_type);
DECL_USER_ALIGN (field) = TYPE_USER_ALIGN (integer_type);
+ layout_nonempty_base_or_field (rli, field, NULL_TREE,
+ empty_base_offsets);
+ if (was_unnamed_p)
+ DECL_NAME (field) = NULL_TREE;
+ /* Now that layout has been performed, set the size of the
+ field to the size of its declared type; the rest of the
+ field is effectively invisible. */
+ DECL_SIZE (field) = TYPE_SIZE (type);
}
-
- layout_nonempty_base_or_field (rli, field, NULL_TREE,
- empty_base_offsets);
- /* If the bit-field had no name originally, remove the name
- now. */
- if (was_unnamed_p)
- DECL_NAME (field) = NULL_TREE;
+ else
+ layout_nonempty_base_or_field (rli, field, NULL_TREE,
+ empty_base_offsets);
/* Remember the location of any empty classes in FIELD. */
if (abi_version_at_least (2))