summaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-expr.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2016-12-16 19:41:13 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2016-12-16 19:41:13 +0000
commit848c151914b84649716fd9b7df55a641a78417c8 (patch)
tree30ead16302dba1ee72ae8b041d1a060178ebf480 /gcc/fortran/trans-expr.c
parentc68b7f595c60737ca86b4913a300bdc2e3448dd8 (diff)
PR fortran/78757
* trans-expr.c (gfc_conv_procedure_call): Emit DECL_EXPR for the type pstr var points to. * gfortran.dg/char_result_16.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243761 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r--gcc/fortran/trans-expr.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index f908c25b9cb3..823c96aa4cd2 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -6009,6 +6009,19 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
{
var = gfc_create_var (type, "pstr");
+ /* Emit a DECL_EXPR for the VLA type. */
+ tmp = TREE_TYPE (type);
+ if (TYPE_SIZE (tmp)
+ && TREE_CODE (TYPE_SIZE (tmp)) != INTEGER_CST)
+ {
+ tmp = build_decl (input_location, TYPE_DECL, NULL_TREE, tmp);
+ DECL_ARTIFICIAL (tmp) = 1;
+ DECL_IGNORED_P (tmp) = 1;
+ tmp = fold_build1_loc (input_location, DECL_EXPR,
+ TREE_TYPE (tmp), tmp);
+ gfc_add_expr_to_block (&se->pre, tmp);
+ }
+
if ((!comp && sym->attr.allocatable)
|| (comp && comp->attr.allocatable))
{