diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2008-04-18 10:10:15 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-04-18 10:10:15 +0000 |
commit | 9a089d8b0620133f2111a2fd2fc5064166ed02a6 (patch) | |
tree | 4b6d57388b539f7e98896fb9a76334f75b1cfae3 /gcc/ada/decl.c | |
parent | c6b196de6c8b35acca8309f9e7fec67932c4e9d7 (diff) | |
download | gcc-9a089d8b0620133f2111a2fd2fc5064166ed02a6.zip gcc-9a089d8b0620133f2111a2fd2fc5064166ed02a6.tar.gz gcc-9a089d8b0620133f2111a2fd2fc5064166ed02a6.tar.bz2 |
decl.c (gnat_to_gnu_entity): Use the return by target pointer mechanism as soon as the size is not constant.
* decl.c (gnat_to_gnu_entity) <E_Subprogram_Type>: Use the return by
target pointer mechanism as soon as the size is not constant.
From-SVN: r134433
Diffstat (limited to 'gcc/ada/decl.c')
-rw-r--r-- | gcc/ada/decl.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index d127ca7..254b70a 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -3725,11 +3725,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) || Has_Foreign_Convention (gnat_entity))) gnu_return_type = TREE_TYPE (TYPE_FIELDS (gnu_return_type)); - /* If the return type is unconstrained, that means it must have a - maximum size. We convert the function into a procedure and its - caller will pass a pointer to an object of that maximum size as the - first parameter when we call the function. */ - if (CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_return_type))) + /* If the return type has a non-constant size, we convert the function + into a procedure and its caller will pass a pointer to an object as + the first parameter when we call the function. This can happen for + an unconstrained type with a maximum size or a constrained type with + a size not known at compile time. */ + if (TYPE_SIZE_UNIT (gnu_return_type) + && !TREE_CONSTANT (TYPE_SIZE_UNIT (gnu_return_type))) { returns_by_target_ptr = true; gnu_param_list |