summaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2003-09-15 00:27:16 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2003-09-15 00:27:16 +0000
commit8cc085df6f7931a68a5bbb6220a4043bf8c8ee1a (patch)
tree55191847f19102bcfd738acb455adb684fe3adce /gcc/cp/class.c
parent53c4d53d132302c132f436cd181dd65772635e33 (diff)
downloadgcc-8cc085df6f7931a68a5bbb6220a4043bf8c8ee1a.tar.gz
* class.c (layout_class_type): Make DECL_MODE match TYPE_MODE for
an bit-field whose width exceeds that of its type. * g++.dg/abi/bitfield11.C: New test. * g++.dg/abi/bitfield12.C: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71392 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 582caf4279e..706ebbff678 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -4759,7 +4759,15 @@ layout_class_type (tree t, tree *virtuals_p)
field to the size of its declared type; the rest of the
field is effectively invisible. */
DECL_SIZE (field) = TYPE_SIZE (type);
- DECL_MODE (field) = TYPE_MODE (type);
+ /* We must also reset the DECL_MODE of the field. */
+ if (abi_version_at_least (2))
+ DECL_MODE (field) = TYPE_MODE (type);
+ else if (warn_abi
+ && DECL_MODE (field) != TYPE_MODE (type))
+ /* Versions of G++ before G++ 3.4 did not reset the
+ DECL_MODE. */
+ warning ("the offset of `%D' may not be ABI-compliant and may "
+ "change in a future version of GCC", field);
}
else
layout_nonempty_base_or_field (rli, field, NULL_TREE,