diff options
Diffstat (limited to 'gcc/fortran/trans-io.c')
-rw-r--r-- | gcc/fortran/trans-io.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 34db6fd5a11..e607e2debe5 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -1611,7 +1611,7 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name, gfc_add_expr_to_block (block, tmp); } - if (ts->type == BT_DERIVED) + if (ts->type == BT_DERIVED && ts->u.derived->components) { gfc_component *cmp; @@ -2146,6 +2146,9 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code) break; case BT_DERIVED: + if (ts->u.derived->components == NULL) + return; + /* Recurse into the elements of the derived type. */ expr = gfc_evaluate_now (addr_expr, &se->pre); expr = build_fold_indirect_ref_loc (input_location, @@ -2251,8 +2254,8 @@ gfc_trans_transfer (gfc_code * code) if (expr->ref && !gfc_is_proc_ptr_comp (expr)) { for (ref = expr->ref; ref && ref->type != REF_ARRAY; - ref = ref->next); - gcc_assert (ref->type == REF_ARRAY); + ref = ref->next); + gcc_assert (ref && ref->type == REF_ARRAY); } if (expr->ts.type != BT_DERIVED |