summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-01 20:06:39 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-01 20:06:39 +0000
commit567b6053bd06322791b565e7482346fa4c288de8 (patch)
treedfba5d100197c5732b44f34d4cbc7459e638abd6
parentb2855272bfcffc7c3bc97a866d4624470dcf6d43 (diff)
downloadgcc-567b6053bd06322791b565e7482346fa4c288de8.tar.gz
2012-06-01 Tobias Burnus <burnus@net-b.de>
PR fortran/53521 * trans.c (gfc_deallocate_scalar_with_status): Properly handle the case size == 0. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@188124 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans.c14
2 files changed, 7 insertions, 13 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index e9d912eb6cf..c5654f63b69 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2012-06-01 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/53521
+ * trans.c (gfc_deallocate_scalar_with_status): Properly
+ handle the case size == 0.
+
2012-05-23 Tobias Burnus <burnus@net-b.de>
PR fortran/53389
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 27a352ab3bd..0dc82409833 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -1005,15 +1005,12 @@ internal_realloc (void *mem, size_t size)
if (!res && size != 0)
_gfortran_os_error ("Allocation would exceed memory limit");
- if (size == 0)
- return NULL;
-
return res;
} */
tree
gfc_call_realloc (stmtblock_t * block, tree mem, tree size)
{
- tree msg, res, nonzero, zero, null_result, tmp;
+ tree msg, res, nonzero, null_result, tmp;
tree type = TREE_TYPE (mem);
size = gfc_evaluate_now (size, block);
@@ -1044,15 +1041,6 @@ gfc_call_realloc (stmtblock_t * block, tree mem, tree size)
build_empty_stmt (input_location));
gfc_add_expr_to_block (block, tmp);
- /* if (size == 0) then the result is NULL. */
- tmp = fold_build2_loc (input_location, MODIFY_EXPR, type, res,
- build_int_cst (type, 0));
- zero = fold_build1_loc (input_location, TRUTH_NOT_EXPR, boolean_type_node,
- nonzero);
- tmp = fold_build3_loc (input_location, COND_EXPR, void_type_node, zero, tmp,
- build_empty_stmt (input_location));
- gfc_add_expr_to_block (block, tmp);
-
return res;
}