diff options
author | Tobias Burnus <burnus@net-b.de> | 2013-07-22 15:33:34 +0200 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2013-07-22 15:33:34 +0200 |
commit | 81fa8ab2d067b39df7bb4fa896c4d2e00e63c45a (patch) | |
tree | aec464d0a6fdb04e5a97d8a68247910372a8dcb4 /gcc/fortran/trans-array.c | |
parent | b5afa1ed4c283baa07f2ad1ad553725adab72600 (diff) | |
download | gcc-81fa8ab2d067b39df7bb4fa896c4d2e00e63c45a.zip gcc-81fa8ab2d067b39df7bb4fa896c4d2e00e63c45a.tar.gz gcc-81fa8ab2d067b39df7bb4fa896c4d2e00e63c45a.tar.bz2 |
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
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r-- | gcc/fortran/trans-array.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 5bcd67d..3fdd8d9 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -5209,29 +5209,31 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg, &se->pre, &set_descriptor_block, &overflow, expr3_elem_size, nelems, expr3, ts); - if (status == NULL_TREE && dimension) + if (dimension) { - var_overflow = gfc_create_var (integer_type_node, "overflow"); gfc_add_modify (&se->pre, var_overflow, overflow); - /* Generate the block of code handling overflow. */ - msg = gfc_build_addr_expr (pchar_type_node, - gfc_build_localized_cstring_const + if (status == NULL_TREE) + { + /* Generate the block of code handling overflow. */ + msg = gfc_build_addr_expr (pchar_type_node, + gfc_build_localized_cstring_const ("Integer overflow when calculating the amount of " "memory to allocate")); - error = build_call_expr_loc (input_location, gfor_fndecl_runtime_error, - 1, msg); - } - else if (status != NULL_TREE) - { - tree status_type = TREE_TYPE (status); - stmtblock_t set_status_block; + error = build_call_expr_loc (input_location, + gfor_fndecl_runtime_error, 1, msg); + } + else + { + tree status_type = TREE_TYPE (status); + stmtblock_t set_status_block; - gfc_start_block (&set_status_block); - gfc_add_modify (&set_status_block, status, - build_int_cst (status_type, LIBERROR_ALLOCATION)); - error = gfc_finish_block (&set_status_block); + gfc_start_block (&set_status_block); + gfc_add_modify (&set_status_block, status, + build_int_cst (status_type, LIBERROR_ALLOCATION)); + error = gfc_finish_block (&set_status_block); + } } gfc_start_block (&elseblock); |