diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2013-10-03 18:13:54 +0200 |
---|---|---|
committer | Marc Glisse <glisse@gcc.gnu.org> | 2013-10-03 16:13:54 +0000 |
commit | 2284b03444d6845ce6402db37f4ec43f6c755f77 (patch) | |
tree | 626a1783dbadedeb04e9dc7b74807b9ad23cc8c7 /gcc/calls.c | |
parent | 0609bdf2114919b570e7a3c4ab273fdf16262a4b (diff) | |
download | gcc-2284b03444d6845ce6402db37f4ec43f6c755f77.zip gcc-2284b03444d6845ce6402db37f4ec43f6c755f77.tar.gz gcc-2284b03444d6845ce6402db37f4ec43f6c755f77.tar.bz2 |
re PR c++/19476 (Missed null checking elimination with new)
2013-10-03 Marc Glisse <marc.glisse@inria.fr>
PR c++/19476
gcc/c-family/
* c.opt (fcheck-new): Move to common.opt.
gcc/
* common.opt (fcheck-new): Moved from c.opt. Make it 'Common'.
* calls.c (alloca_call_p): Use get_callee_fndecl.
* fold-const.c (tree_expr_nonzero_warnv_p): Handle operator new.
* tree-vrp.c (gimple_stmt_nonzero_warnv_p, stmt_interesting_for_vrp):
Likewise.
(vrp_visit_stmt): Remove duplicated code.
gcc/testsuite/
* g++.dg/tree-ssa/pr19476-1.C: New file.
* g++.dg/tree-ssa/pr19476-2.C: Likewise.
* g++.dg/tree-ssa/pr19476-3.C: Likewise.
* g++.dg/tree-ssa/pr19476-4.C: Likewise.
From-SVN: r203163
Diffstat (limited to 'gcc/calls.c')
-rw-r--r-- | gcc/calls.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/gcc/calls.c b/gcc/calls.c index f489f4b..e25f2ab 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -635,11 +635,10 @@ gimple_alloca_call_p (const_gimple stmt) bool alloca_call_p (const_tree exp) { + tree fndecl; if (TREE_CODE (exp) == CALL_EXPR - && TREE_CODE (CALL_EXPR_FN (exp)) == ADDR_EXPR - && (TREE_CODE (TREE_OPERAND (CALL_EXPR_FN (exp), 0)) == FUNCTION_DECL) - && (special_function_p (TREE_OPERAND (CALL_EXPR_FN (exp), 0), 0) - & ECF_MAY_BE_ALLOCA)) + && (fndecl = get_callee_fndecl (exp)) + && (special_function_p (fndecl, 0) & ECF_MAY_BE_ALLOCA)) return true; return false; } |