aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2018-12-14 11:08:15 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2018-12-14 11:08:15 +0000
commit65e0a92b2353927e50a26a3a0628a36aebc85b40 (patch)
tree597d42039a50841cd13bb9ee091a9ea3f7ad56fb /gcc/ada/gcc-interface/decl.c
parentfcdc7fd55df451a405f040733c29b8fe3d20cff1 (diff)
downloadgcc-65e0a92b2353927e50a26a3a0628a36aebc85b40.zip
gcc-65e0a92b2353927e50a26a3a0628a36aebc85b40.tar.gz
gcc-65e0a92b2353927e50a26a3a0628a36aebc85b40.tar.bz2
decl.c (rm_size): Take into account the padding in the case of a record type containing a template.
* gcc-interface/decl.c (rm_size): Take into account the padding in the case of a record type containing a template. * gcc-interface/trans.c (Attribute_to_gnu) <Attr_Size>: Likewise. Do not subtract the padded size for Max_Size_In_Storage_Elements. <Attr_Descriptor_Size>: Tweak comment. From-SVN: r267131
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r--gcc/ada/gcc-interface/decl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 0ad06f1..df55f48 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -10049,13 +10049,14 @@ rm_size (tree gnu_type)
if (INTEGRAL_TYPE_P (gnu_type) && TYPE_RM_SIZE (gnu_type))
return TYPE_RM_SIZE (gnu_type);
- /* Return the RM size of the actual data plus the size of the template. */
+ /* If the type contains a template, return the padded size of the template
+ plus the RM size of the actual data. */
if (TREE_CODE (gnu_type) == RECORD_TYPE
&& TYPE_CONTAINS_TEMPLATE_P (gnu_type))
return
size_binop (PLUS_EXPR,
- rm_size (TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (gnu_type)))),
- DECL_SIZE (TYPE_FIELDS (gnu_type)));
+ bit_position (DECL_CHAIN (TYPE_FIELDS (gnu_type))),
+ rm_size (TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (gnu_type)))));
/* For record or union types, we store the size explicitly. */
if (RECORD_OR_UNION_TYPE_P (gnu_type)