aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2009-04-20 08:14:36 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2009-04-20 08:14:36 +0000
commit56fe7b052dda1139d25bddad2e9fe9cb6ea222bf (patch)
tree12b07c2e67856fa1453bb4666308a9705b08eba0 /gcc/ada
parent9fcf2a0bdc78fbb25b2eb2feb7bd19caebcc82bf (diff)
downloadgcc-56fe7b052dda1139d25bddad2e9fe9cb6ea222bf.zip
gcc-56fe7b052dda1139d25bddad2e9fe9cb6ea222bf.tar.gz
gcc-56fe7b052dda1139d25bddad2e9fe9cb6ea222bf.tar.bz2
trans.c (call_to_gnu): When creating the copy for a non-addressable parameter passed by reference...
* gcc-interface/trans.c (call_to_gnu): When creating the copy for a non-addressable parameter passed by reference, do not convert the actual if its type is already the nominal type, unless it is of self-referential size. From-SVN: r146367
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/gcc-interface/trans.c21
2 files changed, 21 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index ca9d4a8..7075b6f 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,10 @@
+2009-04-20 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (call_to_gnu): When creating the copy for a
+ non-addressable parameter passed by reference, do not convert the
+ actual if its type is already the nominal type, unless it is of
+ self-referential size.
+
2009-04-20 Arnaud Charlet <charlet@adacore.com>
* gnat_ugn.texi: Fix typos.
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 83d32a6..0b46b56 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -2511,12 +2511,19 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
gnat_formal);
}
- /* Remove any unpadding from the object and reset the copy. */
- if (TREE_CODE (gnu_name) == COMPONENT_REF
- && ((TREE_CODE (TREE_TYPE (TREE_OPERAND (gnu_name, 0)))
- == RECORD_TYPE)
- && (TYPE_IS_PADDING_P
- (TREE_TYPE (TREE_OPERAND (gnu_name, 0))))))
+ /* If the actual type of the object is already the nominal type,
+ we have nothing to do, except if the size is self-referential
+ in which case we'll remove the unpadding below. */
+ if (TREE_TYPE (gnu_name) == gnu_name_type
+ && !CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_name_type)))
+ ;
+
+ /* Otherwise remove unpadding from the object and reset the copy. */
+ else if (TREE_CODE (gnu_name) == COMPONENT_REF
+ && ((TREE_CODE (TREE_TYPE (TREE_OPERAND (gnu_name, 0)))
+ == RECORD_TYPE)
+ && (TYPE_IS_PADDING_P
+ (TREE_TYPE (TREE_OPERAND (gnu_name, 0))))))
gnu_name = gnu_copy = TREE_OPERAND (gnu_name, 0);
/* Otherwise convert to the nominal type of the object if it's
@@ -2529,7 +2536,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
else if (TREE_CODE (gnu_name_type) == RECORD_TYPE
&& (TYPE_JUSTIFIED_MODULAR_P (gnu_name_type)
|| smaller_packable_type_p (TREE_TYPE (gnu_name),
- gnu_name_type)))
+ gnu_name_type)))
gnu_name = convert (gnu_name_type, gnu_name);
/* Make a SAVE_EXPR to both properly account for potential side