mirror of git://gcc.gnu.org/git/gcc.git
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
This commit is contained in:
parent
fd2805e11b
commit
fc2655fb30
|
|
@ -1,3 +1,18 @@
|
||||||
|
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
|
||||||
|
|
||||||
2012-09-15 Tobias Burnus <burnus@net-b.de>
|
2012-09-15 Tobias Burnus <burnus@net-b.de>
|
||||||
|
|
||||||
* match.c (lock_unlock_statement, sync_statement): Fix potential
|
* match.c (lock_unlock_statement, sync_statement): Fix potential
|
||||||
|
|
|
||||||
|
|
@ -906,7 +906,10 @@ arith_power (gfc_expr *op1, gfc_expr *op2, gfc_expr **resultp)
|
||||||
if (gfc_notify_std (GFC_STD_F2003, "Noninteger "
|
if (gfc_notify_std (GFC_STD_F2003, "Noninteger "
|
||||||
"exponent in an initialization "
|
"exponent in an initialization "
|
||||||
"expression at %L", &op2->where) == FAILURE)
|
"expression at %L", &op2->where) == FAILURE)
|
||||||
return ARITH_PROHIBIT;
|
{
|
||||||
|
gfc_free_expr (result);
|
||||||
|
return ARITH_PROHIBIT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mpfr_cmp_si (op1->value.real, 0) < 0)
|
if (mpfr_cmp_si (op1->value.real, 0) < 0)
|
||||||
|
|
@ -928,7 +931,10 @@ arith_power (gfc_expr *op1, gfc_expr *op2, gfc_expr **resultp)
|
||||||
if (gfc_notify_std (GFC_STD_F2003, "Noninteger "
|
if (gfc_notify_std (GFC_STD_F2003, "Noninteger "
|
||||||
"exponent in an initialization "
|
"exponent in an initialization "
|
||||||
"expression at %L", &op2->where) == FAILURE)
|
"expression at %L", &op2->where) == FAILURE)
|
||||||
return ARITH_PROHIBIT;
|
{
|
||||||
|
gfc_free_expr (result);
|
||||||
|
return ARITH_PROHIBIT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mpc_pow (result->value.complex, op1->value.complex,
|
mpc_pow (result->value.complex, op1->value.complex,
|
||||||
|
|
|
||||||
|
|
@ -1074,6 +1074,7 @@ gfc_match_array_constructor (gfc_expr **result)
|
||||||
seen_ts = false;
|
seen_ts = false;
|
||||||
|
|
||||||
/* Try to match an optional "type-spec ::" */
|
/* Try to match an optional "type-spec ::" */
|
||||||
|
gfc_clear_ts (&ts);
|
||||||
if (gfc_match_decl_type_spec (&ts, 0) == MATCH_YES)
|
if (gfc_match_decl_type_spec (&ts, 0) == MATCH_YES)
|
||||||
{
|
{
|
||||||
seen_ts = (gfc_match (" ::") == MATCH_YES);
|
seen_ts = (gfc_match (" ::") == MATCH_YES);
|
||||||
|
|
@ -1973,7 +1974,7 @@ got_charlen:
|
||||||
/* If gfc_extract_int above set current_length, we implicitly
|
/* If gfc_extract_int above set current_length, we implicitly
|
||||||
know the type is BT_INTEGER and it's EXPR_CONSTANT. */
|
know the type is BT_INTEGER and it's EXPR_CONSTANT. */
|
||||||
|
|
||||||
has_ts = (expr->ts.u.cl && expr->ts.u.cl->length_from_typespec);
|
has_ts = expr->ts.u.cl->length_from_typespec;
|
||||||
|
|
||||||
if (! cl
|
if (! cl
|
||||||
|| (current_length != -1 && current_length != found_length))
|
|| (current_length != -1 && current_length != found_length))
|
||||||
|
|
@ -2225,13 +2226,15 @@ gfc_array_dimen_size (gfc_expr *array, int dimen, mpz_t *result)
|
||||||
gfc_ref *ref;
|
gfc_ref *ref;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
gcc_assert (array != NULL);
|
||||||
|
|
||||||
if (array->ts.type == BT_CLASS)
|
if (array->ts.type == BT_CLASS)
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
|
|
||||||
if (array->rank == -1)
|
if (array->rank == -1)
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
|
|
||||||
if (dimen < 0 || array == NULL || dimen > array->rank - 1)
|
if (dimen < 0 || dimen > array->rank - 1)
|
||||||
gfc_internal_error ("gfc_array_dimen_size(): Bad dimension");
|
gfc_internal_error ("gfc_array_dimen_size(): Bad dimension");
|
||||||
|
|
||||||
switch (array->expr_type)
|
switch (array->expr_type)
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ numeric_check (gfc_expr *e, int n)
|
||||||
|
|
||||||
/* If the expression has not got a type, check if its namespace can
|
/* If the expression has not got a type, check if its namespace can
|
||||||
offer a default type. */
|
offer a default type. */
|
||||||
if ((e->expr_type == EXPR_VARIABLE || e->expr_type == EXPR_VARIABLE)
|
if ((e->expr_type == EXPR_VARIABLE || e->expr_type == EXPR_FUNCTION)
|
||||||
&& e->symtree->n.sym->ts.type == BT_UNKNOWN
|
&& e->symtree->n.sym->ts.type == BT_UNKNOWN
|
||||||
&& gfc_set_default_type (e->symtree->n.sym, 0,
|
&& gfc_set_default_type (e->symtree->n.sym, 0,
|
||||||
e->symtree->n.sym->ns) == SUCCESS
|
e->symtree->n.sym->ns) == SUCCESS
|
||||||
|
|
|
||||||
|
|
@ -503,7 +503,9 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_attribute *attr,
|
||||||
gfc_component *c;
|
gfc_component *c;
|
||||||
int rank;
|
int rank;
|
||||||
|
|
||||||
if (as && *as && (*as)->type == AS_ASSUMED_SIZE)
|
gcc_assert (as);
|
||||||
|
|
||||||
|
if (*as && (*as)->type == AS_ASSUMED_SIZE)
|
||||||
{
|
{
|
||||||
gfc_error ("Assumed size polymorphic objects or components, such "
|
gfc_error ("Assumed size polymorphic objects or components, such "
|
||||||
"as that at %C, have not yet been implemented");
|
"as that at %C, have not yet been implemented");
|
||||||
|
|
@ -838,6 +840,7 @@ finalize_component (gfc_expr *expr, gfc_symbol *derived, gfc_component *comp,
|
||||||
|
|
||||||
for (c = comp->ts.u.derived->components; c; c = c->next)
|
for (c = comp->ts.u.derived->components; c; c = c->next)
|
||||||
finalize_component (e, c->ts.u.derived, c, stat, code);
|
finalize_component (e, c->ts.u.derived, c, stat, code);
|
||||||
|
gfc_free_expr (e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2248,67 +2248,63 @@ show_namespace (gfc_namespace *ns)
|
||||||
gfc_equiv *eq;
|
gfc_equiv *eq;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
gcc_assert (ns);
|
||||||
save = gfc_current_ns;
|
save = gfc_current_ns;
|
||||||
|
|
||||||
show_indent ();
|
show_indent ();
|
||||||
fputs ("Namespace:", dumpfile);
|
fputs ("Namespace:", dumpfile);
|
||||||
|
|
||||||
if (ns != NULL)
|
i = 0;
|
||||||
|
do
|
||||||
{
|
{
|
||||||
i = 0;
|
int l = i;
|
||||||
do
|
while (i < GFC_LETTERS - 1
|
||||||
{
|
&& gfc_compare_types (&ns->default_type[i+1],
|
||||||
int l = i;
|
&ns->default_type[l]))
|
||||||
while (i < GFC_LETTERS - 1
|
i++;
|
||||||
&& gfc_compare_types(&ns->default_type[i+1],
|
|
||||||
&ns->default_type[l]))
|
|
||||||
i++;
|
|
||||||
|
|
||||||
if (i > l)
|
if (i > l)
|
||||||
fprintf (dumpfile, " %c-%c: ", l+'A', i+'A');
|
fprintf (dumpfile, " %c-%c: ", l+'A', i+'A');
|
||||||
else
|
else
|
||||||
fprintf (dumpfile, " %c: ", l+'A');
|
fprintf (dumpfile, " %c: ", l+'A');
|
||||||
|
|
||||||
show_typespec(&ns->default_type[l]);
|
show_typespec(&ns->default_type[l]);
|
||||||
i++;
|
i++;
|
||||||
} while (i < GFC_LETTERS);
|
} while (i < GFC_LETTERS);
|
||||||
|
|
||||||
if (ns->proc_name != NULL)
|
if (ns->proc_name != NULL)
|
||||||
{
|
{
|
||||||
show_indent ();
|
show_indent ();
|
||||||
fprintf (dumpfile, "procedure name = %s", ns->proc_name->name);
|
fprintf (dumpfile, "procedure name = %s", ns->proc_name->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
++show_level;
|
++show_level;
|
||||||
gfc_current_ns = ns;
|
gfc_current_ns = ns;
|
||||||
gfc_traverse_symtree (ns->common_root, show_common);
|
gfc_traverse_symtree (ns->common_root, show_common);
|
||||||
|
|
||||||
gfc_traverse_symtree (ns->sym_root, show_symtree);
|
gfc_traverse_symtree (ns->sym_root, show_symtree);
|
||||||
|
|
||||||
for (op = GFC_INTRINSIC_BEGIN; op != GFC_INTRINSIC_END; op++)
|
for (op = GFC_INTRINSIC_BEGIN; op != GFC_INTRINSIC_END; op++)
|
||||||
{
|
{
|
||||||
/* User operator interfaces */
|
/* User operator interfaces */
|
||||||
intr = ns->op[op];
|
intr = ns->op[op];
|
||||||
if (intr == NULL)
|
if (intr == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
show_indent ();
|
show_indent ();
|
||||||
fprintf (dumpfile, "Operator interfaces for %s:",
|
fprintf (dumpfile, "Operator interfaces for %s:",
|
||||||
gfc_op2string ((gfc_intrinsic_op) op));
|
gfc_op2string ((gfc_intrinsic_op) op));
|
||||||
|
|
||||||
for (; intr; intr = intr->next)
|
for (; intr; intr = intr->next)
|
||||||
fprintf (dumpfile, " %s", intr->sym->name);
|
fprintf (dumpfile, " %s", intr->sym->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ns->uop_root != NULL)
|
if (ns->uop_root != NULL)
|
||||||
{
|
{
|
||||||
show_indent ();
|
show_indent ();
|
||||||
fputs ("User operators:\n", dumpfile);
|
fputs ("User operators:\n", dumpfile);
|
||||||
gfc_traverse_user_op (ns, show_uop);
|
gfc_traverse_user_op (ns, show_uop);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
++show_level;
|
|
||||||
|
|
||||||
for (eq = ns->equiv; eq; eq = eq->next)
|
for (eq = ns->equiv; eq; eq = eq->next)
|
||||||
show_equiv (eq);
|
show_equiv (eq);
|
||||||
|
|
|
||||||
|
|
@ -1611,7 +1611,7 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name,
|
||||||
gfc_add_expr_to_block (block, tmp);
|
gfc_add_expr_to_block (block, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ts->type == BT_DERIVED)
|
if (ts->type == BT_DERIVED && ts->u.derived->components)
|
||||||
{
|
{
|
||||||
gfc_component *cmp;
|
gfc_component *cmp;
|
||||||
|
|
||||||
|
|
@ -2146,6 +2146,9 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BT_DERIVED:
|
case BT_DERIVED:
|
||||||
|
if (ts->u.derived->components == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
/* Recurse into the elements of the derived type. */
|
/* Recurse into the elements of the derived type. */
|
||||||
expr = gfc_evaluate_now (addr_expr, &se->pre);
|
expr = gfc_evaluate_now (addr_expr, &se->pre);
|
||||||
expr = build_fold_indirect_ref_loc (input_location,
|
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))
|
if (expr->ref && !gfc_is_proc_ptr_comp (expr))
|
||||||
{
|
{
|
||||||
for (ref = expr->ref; ref && ref->type != REF_ARRAY;
|
for (ref = expr->ref; ref && ref->type != REF_ARRAY;
|
||||||
ref = ref->next);
|
ref = ref->next);
|
||||||
gcc_assert (ref->type == REF_ARRAY);
|
gcc_assert (ref && ref->type == REF_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expr->ts.type != BT_DERIVED
|
if (expr->ts.type != BT_DERIVED
|
||||||
|
|
|
||||||
|
|
@ -506,6 +506,7 @@ gfc_trans_runtime_check (bool error, bool once, tree cond, stmtblock_t * pblock,
|
||||||
gfc_add_expr_to_block (&block,
|
gfc_add_expr_to_block (&block,
|
||||||
trans_runtime_error_vararg (error, where,
|
trans_runtime_error_vararg (error, where,
|
||||||
msgid, ap));
|
msgid, ap));
|
||||||
|
va_end (ap);
|
||||||
|
|
||||||
if (once)
|
if (once)
|
||||||
gfc_add_modify (&block, tmpvar, boolean_false_node);
|
gfc_add_modify (&block, tmpvar, boolean_false_node);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue