diff options
author | Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2015-08-31 10:54:36 +0000 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2015-08-31 10:54:36 +0000 |
commit | cd55d18e5da549f75cc2ae0bbfb69aa232753c19 (patch) | |
tree | d04fceb6086a4283f6c960bd6b0a4aa424dd31d5 /gcc/fortran/trans.c | |
parent | e78549932d92690dd277938fac358c039a5d210d (diff) | |
download | gcc-cd55d18e5da549f75cc2ae0bbfb69aa232753c19.tar.gz |
re PR fortran/54833 (Don't wrap __builtin_free(a) in if (a != NULL))
PR fortran/54833
* trans.c (gfc_call_free): Don't check if pointer is NULL.
* trans.h (gfc_call_free): Adjust comment.
From-SVN: r227336
Diffstat (limited to 'gcc/fortran/trans.c')
-rw-r--r-- | gcc/fortran/trans.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 457c0e25210..f30809a9fda 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -850,23 +850,14 @@ gfc_allocate_allocatable (stmtblock_t * block, tree mem, tree size, tree token, } -/* Free a given variable, if it's not NULL. */ +/* Free a given variable. */ tree gfc_call_free (tree var) { - tree cond, call; - - /* Only evaluate the variable once. */ - var = save_expr (fold_convert (pvoid_type_node, var)); - - cond = fold_build2_loc (input_location, NE_EXPR, boolean_type_node, var, - build_int_cst (pvoid_type_node, 0)); - call = build_call_expr_loc (input_location, + return build_call_expr_loc (input_location, builtin_decl_explicit (BUILT_IN_FREE), - 1, var); - return fold_build3_loc (input_location, COND_EXPR, void_type_node, - cond, call, build_empty_stmt (input_location)); + 1, fold_convert (pvoid_type_node, var)); } |