diff options
Diffstat (limited to 'gcc/fortran')
| -rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
| -rw-r--r-- | gcc/fortran/expr.c | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 3d79fca..a0256e1 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2016-05-14 Fritz Reese <fritzoreese@gmail.com> + + PR fortran/71047 + * expr.c (gfc_default_initializer): Avoid extra component refs in + constructors for derived types and classes. + 2016-05-11 Jakub Jelinek <jakub@redhat.com> PR fortran/70855 diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 6ebe08b..d1258cd 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -3975,7 +3975,10 @@ gfc_default_initializer (gfc_typespec *ts) if (comp->initializer) { - ctor->n.component = comp; + /* Save the component ref for STRUCTUREs and UNIONs. */ + if (ts->u.derived->attr.flavor == FL_STRUCT + || ts->u.derived->attr.flavor == FL_UNION) + ctor->n.component = comp; ctor->expr = gfc_copy_expr (comp->initializer); if ((comp->ts.type != comp->initializer->ts.type || comp->ts.kind != comp->initializer->ts.kind) |
