diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2016-11-22 21:52:15 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2016-11-22 21:52:15 +0000 |
commit | 7e98cccbd85a0bc5ec6b7edf0017d98c2e96aef5 (patch) | |
tree | 8bceaa50e6ac9a2dbefc7dcde232417bd2186f0f /gcc/fortran/expr.c | |
parent | 7239bf746acb27f8b116e0fbf1b6e40ec12d40d3 (diff) | |
download | gcc-7e98cccbd85a0bc5ec6b7edf0017d98c2e96aef5.zip gcc-7e98cccbd85a0bc5ec6b7edf0017d98c2e96aef5.tar.gz gcc-7e98cccbd85a0bc5ec6b7edf0017d98c2e96aef5.tar.bz2 |
re PR fortran/78479 (ICE in gfc_apply_init, at fortran/expr.c:4135)
2016-11-22 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/78479
* expr.c (gfc_apply_init): Allocate a charlen if needed.
2016-11-22 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/78479
* gfortran.dg/char_component_initializer_3.f90: New test.
From-SVN: r242725
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index e2d1311..b028d81 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -4132,7 +4132,12 @@ gfc_apply_init (gfc_typespec *ts, symbol_attribute *attr, gfc_expr *init) { gfc_set_constant_character_len (len, ctor->expr, has_ts ? -1 : first_len); - ctor->expr->ts.u.cl->length = gfc_copy_expr (ts->u.cl->length); + if (!ctor->expr->ts.u.cl) + ctor->expr->ts.u.cl + = gfc_new_charlen (gfc_current_ns, ts->u.cl); + else + ctor->expr->ts.u.cl->length + = gfc_copy_expr (ts->u.cl->length); } } } |