aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/trans.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2009-09-16 15:02:25 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2009-09-16 15:02:25 +0000
commit20faffe76f5c17d2f21a7946be0e19d0f4898b89 (patch)
treea8492b49df136bd364c700bf2d8efd42ab2fc74c /gcc/ada/gcc-interface/trans.c
parent721641c415fa5d97709ce25219c2d492e54d85d4 (diff)
downloadgcc-20faffe76f5c17d2f21a7946be0e19d0f4898b89.zip
gcc-20faffe76f5c17d2f21a7946be0e19d0f4898b89.tar.gz
gcc-20faffe76f5c17d2f21a7946be0e19d0f4898b89.tar.bz2
trans.c (Attribute_to_gnu): Strip conversions between original and packable version of types from the...
* gcc-interface/trans.c (Attribute_to_gnu) <Attr_Size>: Strip conversions between original and packable version of types from the expression. From-SVN: r151757
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r--gcc/ada/gcc-interface/trans.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 5bce21a..a90a7a0 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -1279,9 +1279,16 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
case Attr_Max_Size_In_Storage_Elements:
gnu_expr = gnu_prefix;
- /* Remove NOPs from GNU_EXPR and conversions from GNU_PREFIX.
- We only use GNU_EXPR to see if a COMPONENT_REF was involved. */
- while (TREE_CODE (gnu_expr) == NOP_EXPR)
+ /* Remove NOPs and conversions between original and packable version
+ from GNU_EXPR, and conversions from GNU_PREFIX. We use GNU_EXPR
+ to see if a COMPONENT_REF was involved. */
+ while (TREE_CODE (gnu_expr) == NOP_EXPR
+ || (TREE_CODE (gnu_expr) == VIEW_CONVERT_EXPR
+ && TREE_CODE (TREE_TYPE (gnu_expr)) == RECORD_TYPE
+ && TREE_CODE (TREE_TYPE (TREE_OPERAND (gnu_expr, 0)))
+ == RECORD_TYPE
+ && TYPE_NAME (TREE_TYPE (gnu_expr))
+ == TYPE_NAME (TREE_TYPE (TREE_OPERAND (gnu_expr, 0)))))
gnu_expr = TREE_OPERAND (gnu_expr, 0);
gnu_prefix = remove_conversions (gnu_prefix, true);