From 20faffe76f5c17d2f21a7946be0e19d0f4898b89 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 16 Sep 2009 15:02:25 +0000 Subject: trans.c (Attribute_to_gnu): Strip conversions between original and packable version of types from the... * gcc-interface/trans.c (Attribute_to_gnu) : Strip conversions between original and packable version of types from the expression. From-SVN: r151757 --- gcc/ada/gcc-interface/trans.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'gcc/ada/gcc-interface/trans.c') 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); -- cgit v1.1