summaryrefslogtreecommitdiffstats
path: root/gcc/fortran
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog9
-rw-r--r--gcc/fortran/data.c7
-rw-r--r--gcc/fortran/decl.c5
3 files changed, 18 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 2b316774906..f9bbf8a167e 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,6 +1,15 @@
2012-08-28 Tobias Burnus <burnus@net-b.de>
PR fortran/54384
+ * decl.c (match_data_constant): Add missing gfc_free_expr.
+ (top_val_list): Remove always-true condition.
+ * data.c (get_array_index, create_character_initializer):
+ Free temporary expressions.
+ (gfc_assign_data_value): Free expression when aborting.
+
+2012-08-28 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/54384
* symbol.c (gfc_copy_formal_args): Set also sym->formal_ns.
2012-08-27 Tobias Burnus <burnus@net-b.de>
diff --git a/gcc/fortran/data.c b/gcc/fortran/data.c
index 385ca898dcd..de8c0ca8f5c 100644
--- a/gcc/fortran/data.c
+++ b/gcc/fortran/data.c
@@ -66,6 +66,7 @@ get_array_index (gfc_array_ref *ar, mpz_t *offset)
gfc_error ("non-constant array in DATA statement %L", &ar->where);
mpz_set (tmp, e->value.integer);
+ gfc_free_expr (e);
mpz_sub (tmp, tmp, ar->as->lower[i]->value.integer);
mpz_mul (tmp, tmp, delta);
mpz_add (*offset, tmp, *offset);
@@ -138,8 +139,10 @@ create_character_initializer (gfc_expr *init, gfc_typespec *ts,
}
gfc_extract_int (start_expr, &start);
+ gfc_free_expr (start_expr);
start--;
gfc_extract_int (end_expr, &end);
+ gfc_free_expr (end_expr);
}
else
{
@@ -200,7 +203,7 @@ gfc_assign_data_value (gfc_expr *lvalue, gfc_expr *rvalue, mpz_t index,
{
gfc_ref *ref;
gfc_expr *init;
- gfc_expr *expr;
+ gfc_expr *expr = NULL;
gfc_constructor *con;
gfc_constructor *last_con;
gfc_symbol *symbol;
@@ -500,6 +503,8 @@ gfc_assign_data_value (gfc_expr *lvalue, gfc_expr *rvalue, mpz_t index,
return SUCCESS;
abort:
+ if (!init)
+ gfc_free_expr (expr);
mpz_clear (offset);
return FAILURE;
}
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index efd21dc7ec7..6f609e9a5a7 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -361,6 +361,8 @@ match_data_constant (gfc_expr **result)
m = MATCH_ERROR;
return m;
}
+ else if (m == MATCH_YES)
+ gfc_free_expr (*result);
gfc_current_locus = old_loc;
@@ -451,8 +453,7 @@ top_val_list (gfc_data *data)
}
else
{
- if (expr->ts.type == BT_INTEGER)
- mpz_set (tail->repeat, expr->value.integer);
+ mpz_set (tail->repeat, expr->value.integer);
gfc_free_expr (expr);
m = match_data_constant (&tail->expr);
OpenPOWER on IntegriCloud