aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-io.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2012-09-15 17:44:22 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2012-09-15 17:44:22 +0200
commitfc2655fb3082182075b288b58c93ac563ef661a0 (patch)
treecbc423f1f72886520c3332a55320578a49eb12e1 /gcc/fortran/trans-io.c
parentfd2805e11b7018a148a4f87201b4d85344b5aad4 (diff)
downloadgcc-fc2655fb3082182075b288b58c93ac563ef661a0.zip
gcc-fc2655fb3082182075b288b58c93ac563ef661a0.tar.gz
gcc-fc2655fb3082182075b288b58c93ac563ef661a0.tar.bz2
arith.c (arith_power): Call gfc_free_expr in case of error.
2012-09-15 Tobias Burnus <burnus@net-b.de> * arith.c (arith_power): Call gfc_free_expr in case of error. * array.c (gfc_match_array_constructor): Initialize variable. (gfc_resolve_character_array_constructor): Remove superfluous check. (gfc_array_dimen_size): Add assert. * check.c (numeric_check): Fix implicit typing. * class.c (gfc_build_class_symbol): Add assert. (finalize_component): Free memory. * dump-parse-tree.c (show_namespace): Add assert. * trans-io.c (transfer_namelist_element, transfer_expr): Avoid memory leakage. (gfc_trans_transfer): Add assert. * trans.c (gfc_trans_runtime_check): Call va_end From-SVN: r191344
Diffstat (limited to 'gcc/fortran/trans-io.c')
-rw-r--r--gcc/fortran/trans-io.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index 34db6fd..e607e2d 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