re PR c++/19476 (Missed null checking elimination with new)

2013-10-04  Marc Glisse  <marc.glisse@inria.fr>

	PR c++/19476
gcc/cp/
	* decl.c (cxx_init_decl_processing): Set operator_new_flag.

gcc/testsuite/
	* g++.dg/tree-ssa/pr19476-5.C: New file.
	* g++.dg/tree-ssa/pr19476-1.C: Mention pr19476-5.C.

From-SVN: r203194
This commit is contained in:
Marc Glisse 2013-10-04 01:48:18 +02:00 committed by Marc Glisse
parent 2765f89725
commit f0aaf8c1ae
5 changed files with 25 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2013-10-04 Marc Glisse <marc.glisse@inria.fr>
PR c++/19476
* decl.c (cxx_init_decl_processing): Set operator_new_flag.
2013-10-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58584

View File

@ -3800,8 +3800,8 @@ cxx_init_decl_processing (void)
newtype = build_exception_variant (newtype, new_eh_spec);
deltype = cp_build_type_attribute_variant (void_ftype_ptr, extvisattr);
deltype = build_exception_variant (deltype, empty_except_spec);
push_cp_library_fn (NEW_EXPR, newtype, 0);
push_cp_library_fn (VEC_NEW_EXPR, newtype, 0);
DECL_IS_OPERATOR_NEW (push_cp_library_fn (NEW_EXPR, newtype, 0)) = 1;
DECL_IS_OPERATOR_NEW (push_cp_library_fn (VEC_NEW_EXPR, newtype, 0)) = 1;
global_delete_fndecl = push_cp_library_fn (DELETE_EXPR, deltype, ECF_NOTHROW);
push_cp_library_fn (VEC_DELETE_EXPR, deltype, ECF_NOTHROW);

View File

@ -1,3 +1,9 @@
2013-10-04 Marc Glisse <marc.glisse@inria.fr>
PR c++/19476
* g++.dg/tree-ssa/pr19476-5.C: New file.
* g++.dg/tree-ssa/pr19476-1.C: Mention pr19476-5.C.
2013-10-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58584

View File

@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-ccp1" } */
// See pr19476-5.C for a version without including <new>.
#include <new>
int f(){

View File

@ -0,0 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-ccp1" } */
// See pr19476-1.C for a version that includes <new>.
int g(){
return 42 + (0 == new int[50]);
}
/* { dg-final { scan-tree-dump "return 42" "ccp1" } } */
/* { dg-final { cleanup-tree-dump "ccp1" } } */