diff options
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 5eef939..2bf980c 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -2406,7 +2406,7 @@ gfc_default_initializer (gfc_typespec *ts) /* See if we have a default initializer. */ for (c = ts->derived->components; c; c = c->next) { - if (c->initializer && init == NULL) + if ((c->initializer || c->allocatable) && init == NULL) init = gfc_get_expr (); } @@ -2430,6 +2430,13 @@ gfc_default_initializer (gfc_typespec *ts) if (c->initializer) tail->expr = gfc_copy_expr (c->initializer); + + if (c->allocatable) + { + tail->expr = gfc_get_expr (); + tail->expr->expr_type = EXPR_NULL; + tail->expr->ts = c->ts; + } } return init; } |