Commit 81fa8ab2 by Tobias Burnus Committed by Tobias Burnus

trans-array.c (gfc_array_allocate): Correct memory-leak patch.

2013-07-22  Tobias Burnus  <burnus@net-b.de>

        * trans-array.c (gfc_array_allocate): Correct memory-leak patch.

From-SVN: r201129
parent b5afa1ed
2013-07-22 Tobias Burnus <burnus@net-b.de> 2013-07-22 Tobias Burnus <burnus@net-b.de>
* trans-array.c (gfc_array_allocate): Correct memory-leak patch.
2013-07-22 Tobias Burnus <burnus@net-b.de>
* trans-array.c (gfc_array_allocate, * trans-array.c (gfc_array_allocate,
gfc_trans_deferred_array): Plug memory leak. gfc_trans_deferred_array): Plug memory leak.
......
...@@ -5209,21 +5209,22 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg, ...@@ -5209,21 +5209,22 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg,
&se->pre, &set_descriptor_block, &overflow, &se->pre, &set_descriptor_block, &overflow,
expr3_elem_size, nelems, expr3, ts); expr3_elem_size, nelems, expr3, ts);
if (status == NULL_TREE && dimension) if (dimension)
{ {
var_overflow = gfc_create_var (integer_type_node, "overflow"); var_overflow = gfc_create_var (integer_type_node, "overflow");
gfc_add_modify (&se->pre, var_overflow, overflow); gfc_add_modify (&se->pre, var_overflow, overflow);
if (status == NULL_TREE)
{
/* Generate the block of code handling overflow. */ /* Generate the block of code handling overflow. */
msg = gfc_build_addr_expr (pchar_type_node, msg = gfc_build_addr_expr (pchar_type_node,
gfc_build_localized_cstring_const gfc_build_localized_cstring_const
("Integer overflow when calculating the amount of " ("Integer overflow when calculating the amount of "
"memory to allocate")); "memory to allocate"));
error = build_call_expr_loc (input_location, gfor_fndecl_runtime_error, error = build_call_expr_loc (input_location,
1, msg); gfor_fndecl_runtime_error, 1, msg);
} }
else if (status != NULL_TREE) else
{ {
tree status_type = TREE_TYPE (status); tree status_type = TREE_TYPE (status);
stmtblock_t set_status_block; stmtblock_t set_status_block;
...@@ -5233,6 +5234,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg, ...@@ -5233,6 +5234,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg,
build_int_cst (status_type, LIBERROR_ALLOCATION)); build_int_cst (status_type, LIBERROR_ALLOCATION));
error = gfc_finish_block (&set_status_block); error = gfc_finish_block (&set_status_block);
} }
}
gfc_start_block (&elseblock); gfc_start_block (&elseblock);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment