diff options
author | Ian Lance Taylor <iant@google.com> | 2008-01-18 15:25:02 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2008-01-18 15:25:02 +0000 |
commit | 1ea193c21f060b7e7837138122b24c9d07f57d57 (patch) | |
tree | f599ef6905608f93f1d83e94f82e9ef89480d5b3 /gcc/tree.h | |
parent | c27fb14bda0b2c82c0fe8413e3e2f805c1d58975 (diff) | |
download | gcc-1ea193c21f060b7e7837138122b24c9d07f57d57.zip gcc-1ea193c21f060b7e7837138122b24c9d07f57d57.tar.gz gcc-1ea193c21f060b7e7837138122b24c9d07f57d57.tar.bz2 |
re PR c++/33407 (C++ operator new and new expression do not change dynamic type)
PR c++/33407
./: * tree.h (DECL_IS_OPERATOR_NEW): Define.
(struct tree_function_decl): Add new field operator_new_flag.
* tree-inline.c (expand_call_inline): When inlining a call to
operator new, force the return value to go into a variable, and
set DECL_NO_TBAA_P on that variable.
* c-decl.c (merge_decls): Merge DECL_IS_OPERATOR_NEW flag.
cp/:
* decl.c (duplicate_decls): Copy DECL_IS_OPERATOR_NEW flag.
(grok_op_properties): For NEW_EXPR and VEC_NEW_EXPR set
DECL_IS_OPERATOR_NEW flag.
testsuite/:
* g++.dg/init/new26.C: New test.
From-SVN: r131629
Diffstat (limited to 'gcc/tree.h')
-rw-r--r-- | gcc/tree.h | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -1,6 +1,7 @@ /* Front-end tree definitions for GNU compiler. Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + Free Software Foundation, Inc. This file is part of GCC. @@ -3241,6 +3242,12 @@ struct tree_decl_non_common GTY(()) not an alias. */ #define DECL_IS_MALLOC(NODE) (FUNCTION_DECL_CHECK (NODE)->function_decl.malloc_flag) +/* Nonzero in a FUNCTION_DECL means this function should be treated as + C++ operator new, meaning that it returns a pointer for which we + should not use type based aliasing. */ +#define DECL_IS_OPERATOR_NEW(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.operator_new_flag) + /* Nonzero in a FUNCTION_DECL means this function may return more than once. */ #define DECL_IS_RETURNS_TWICE(NODE) \ @@ -3345,16 +3352,17 @@ struct tree_function_decl GTY(()) unsigned novops_flag : 1; unsigned returns_twice_flag : 1; unsigned malloc_flag : 1; + unsigned operator_new_flag : 1; unsigned pure_flag : 1; unsigned declared_inline_flag : 1; unsigned regdecl_flag : 1; - unsigned inline_flag : 1; + unsigned inline_flag : 1; unsigned no_instrument_function_entry_exit : 1; unsigned no_limit_stack : 1; unsigned disregard_inline_limits : 1; - /* 5 bits left */ + /* 4 bits left */ }; /* For a TYPE_DECL, holds the "original" type. (TREE_TYPE has the copy.) */ |