aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
diff options
context:
space:
mode:
authorJanus Weil <janus@gcc.gnu.org>2009-08-17 11:11:00 +0200
committerJanus Weil <janus@gcc.gnu.org>2009-08-17 11:11:00 +0200
commitb76e28c64d8a13f0fcaf6bddee53c06115c1d186 (patch)
treeb8373165dd65e8525462591a15c32863293ad590 /gcc/fortran/decl.c
parente9d9afef6f725fc3444d2639c0961a70b1da54a0 (diff)
downloadgcc-b76e28c64d8a13f0fcaf6bddee53c06115c1d186.zip
gcc-b76e28c64d8a13f0fcaf6bddee53c06115c1d186.tar.gz
gcc-b76e28c64d8a13f0fcaf6bddee53c06115c1d186.tar.bz2
re PR fortran/40877 (memory leaks with gfc_charlen?)
2009-08-17 Janus Weil <janus@gcc.gnu.org> PR fortran/40877 * array.c (gfc_resolve_character_array_constructor): Add NULL argument to gfc_new_charlen. * decl.c (add_init_expr_to_sym,variable_decl,match_char_spec, gfc_match_implicit): Ditto. * expr.c (simplify_const_ref): Fix memory leak. (gfc_simplify_expr): Add NULL argument to gfc_new_charlen. * gfortran.h (gfc_new_charlen): Modified prototype. * iresolve.c (check_charlen_present,gfc_resolve_char_achar): Add NULL argument to gfc_new_charlen. * module.c (mio_charlen): Ditto. * resolve.c (gfc_resolve_substring_charlen, gfc_resolve_character_operator,fixup_charlen): Ditto. (resolve_fl_derived,resolve_symbol): Add argument to gfc_charlen. * symbol.c (gfc_new_charlen): Add argument 'old_cl' (to make a copy of an existing charlen). (gfc_set_default_type,generate_isocbinding_symbol): Fix memory leak. (gfc_copy_formal_args_intr): Add NULL argument to gfc_new_charlen. * trans-decl.c (create_function_arglist): Fix memory leak. From-SVN: r150823
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r--gcc/fortran/decl.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index d5206a0..e4813b8 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1265,7 +1265,7 @@ add_init_expr_to_sym (const char *name, gfc_expr **initp, locus *var_locus)
int clen;
/* If there are multiple CHARACTER variables declared on the
same line, we don't want them to share the same length. */
- sym->ts.u.cl = gfc_new_charlen (gfc_current_ns);
+ sym->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
if (sym->attr.flavor == FL_PARAMETER)
{
@@ -1297,7 +1297,7 @@ add_init_expr_to_sym (const char *name, gfc_expr **initp, locus *var_locus)
{
/* Build a new charlen to prevent simplification from
deleting the length before it is resolved. */
- init->ts.u.cl = gfc_new_charlen (gfc_current_ns);
+ init->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
init->ts.u.cl->length = gfc_copy_expr (sym->ts.u.cl->length);
for (p = init->value.constructor; p; p = p->next)
@@ -1601,7 +1601,7 @@ variable_decl (int elem)
switch (match_char_length (&char_len))
{
case MATCH_YES:
- cl = gfc_new_charlen (gfc_current_ns);
+ cl = gfc_new_charlen (gfc_current_ns, NULL);
cl->length = char_len;
break;
@@ -1613,7 +1613,7 @@ variable_decl (int elem)
&& (current_ts.u.cl->length == NULL
|| current_ts.u.cl->length->expr_type != EXPR_CONSTANT))
{
- cl = gfc_new_charlen (gfc_current_ns);
+ cl = gfc_new_charlen (gfc_current_ns, NULL);
cl->length = gfc_copy_expr (current_ts.u.cl->length);
}
else
@@ -2235,7 +2235,7 @@ done:
}
/* Do some final massaging of the length values. */
- cl = gfc_new_charlen (gfc_current_ns);
+ cl = gfc_new_charlen (gfc_current_ns, NULL);
if (seen_length == 0)
cl->length = gfc_int_expr (1);
@@ -2618,7 +2618,7 @@ gfc_match_implicit (void)
if (ts.type == BT_CHARACTER && !ts.u.cl)
{
ts.kind = gfc_default_character_kind;
- ts.u.cl = gfc_new_charlen (gfc_current_ns);
+ ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
ts.u.cl->length = gfc_int_expr (1);
}