diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2010-05-05 17:48:01 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2010-05-05 17:48:01 +0000 |
commit | ca361dec8f52c32553ce31f58acb414869b0b7a8 (patch) | |
tree | 25b31da61091c6f507a936a90a2a40d3b14c9a1b /gcc/gimplify.c | |
parent | fa6aeae1ad6baf1e8e201508c9db8b4df00024df (diff) | |
download | gcc-ca361dec8f52c32553ce31f58acb414869b0b7a8.zip gcc-ca361dec8f52c32553ce31f58acb414869b0b7a8.tar.gz gcc-ca361dec8f52c32553ce31f58acb414869b0b7a8.tar.bz2 |
gimplify.c (gimplify_return_expr): Gimplify the size expressions of a variable-sized RESULT_DECL.
* gimplify.c (gimplify_return_expr): Gimplify the size expressions of
a variable-sized RESULT_DECL.
From-SVN: r159074
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 8f7ff89..8d2bc58 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1228,9 +1228,22 @@ gimplify_return_expr (tree stmt, gimple_seq *pre_p) hard_function_value generates a PARALLEL, we'll die during normal expansion of structure assignments; there's special code in expand_return to handle this case that does not exist in expand_expr. */ - if (!result_decl - || aggregate_value_p (result_decl, TREE_TYPE (current_function_decl))) - result = result_decl; + if (!result_decl) + result = NULL_TREE; + else if (aggregate_value_p (result_decl, TREE_TYPE (current_function_decl))) + { + if (TREE_CODE (DECL_SIZE (result_decl)) != INTEGER_CST) + { + if (!TYPE_SIZES_GIMPLIFIED (TREE_TYPE (result_decl))) + gimplify_type_sizes (TREE_TYPE (result_decl), pre_p); + /* Note that we don't use gimplify_vla_decl because the RESULT_DECL + should be effectively allocated by the caller, i.e. all calls to + this function must be subject to the Return Slot Optimization. */ + gimplify_one_sizepos (&DECL_SIZE (result_decl), pre_p); + gimplify_one_sizepos (&DECL_SIZE_UNIT (result_decl), pre_p); + } + result = result_decl; + } else if (gimplify_ctxp->return_temp) result = gimplify_ctxp->return_temp; else |