diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2009-10-29 18:17:18 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2009-10-29 18:17:18 +0000 |
commit | 6b1cce3ada17796f7d93403fa65a7e4bdce8173b (patch) | |
tree | 89b6cdf039d94054537dbef9c69a24a9f80c8d8b /gcc/ada | |
parent | d0539838389f4febb4582217a93e90141a642745 (diff) | |
download | gcc-6b1cce3ada17796f7d93403fa65a7e4bdce8173b.tar.gz |
trans.c (Attribute_to_gnu): Do not return the RM size for padded types.
* gcc-interface/trans.c (Attribute_to_gnu) <Attr_Object_Size>: Do not
return the RM size for padded types.
From-SVN: r153720
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 26 |
2 files changed, 18 insertions, 13 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 0c5382e8fc0..b5b1e6cc8b9 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2009-10-29 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/trans.c (Attribute_to_gnu) <Attr_Object_Size>: Do not + return the RM size for padded types. + 2009-10-28 Robert Dewar <dewar@adacore.com> * sem_type.adb: Minor reformatting diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 271581a65e8..58afbfddac6 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -1317,28 +1317,28 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) } /* If we're looking for the size of a field, return the field size. - Otherwise, if the prefix is an object, or if 'Object_Size or - 'Max_Size_In_Storage_Elements has been specified, the result is the - GCC size of the type. Otherwise, the result is the RM size of the - type. */ + Otherwise, if the prefix is an object, or if we're looking for + 'Object_Size or 'Max_Size_In_Storage_Elements, the result is the + GCC size of the type. Otherwise, it is the RM size of the type. */ if (TREE_CODE (gnu_prefix) == COMPONENT_REF) gnu_result = DECL_SIZE (TREE_OPERAND (gnu_prefix, 1)); else if (TREE_CODE (gnu_prefix) != TYPE_DECL || attribute == Attr_Object_Size || attribute == Attr_Max_Size_In_Storage_Elements) { - /* If this is a padded type, the GCC size isn't relevant to the - programmer. Normally, what we want is the RM size, which was set - from the specified size, but if it was not set, we want the size - of the relevant field. Using the MAX of those two produces the - right result in all case. Don't use the size of the field if it's - a self-referential type, since that's never what's wanted. */ - if (TYPE_IS_PADDING_P (gnu_type) + /* If the prefix is an object of a padded type, the GCC size isn't + relevant to the programmer. Normally what we want is the RM size, + which was set from the specified size, but if it was not set, we + want the size of the field. Using the MAX of those two produces + the right result in all cases. Don't use the size of the field + if it's self-referential, since that's never what's wanted. */ + if (TREE_CODE (gnu_prefix) != TYPE_DECL + && TYPE_IS_PADDING_P (gnu_type) && TREE_CODE (gnu_expr) == COMPONENT_REF) { gnu_result = rm_size (gnu_type); - if (!(CONTAINS_PLACEHOLDER_P - (DECL_SIZE (TREE_OPERAND (gnu_expr, 1))))) + if (!CONTAINS_PLACEHOLDER_P + (DECL_SIZE (TREE_OPERAND (gnu_expr, 1)))) gnu_result = size_binop (MAX_EXPR, gnu_result, DECL_SIZE (TREE_OPERAND (gnu_expr, 1))); |