summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2007-07-24 11:08:27 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2007-07-24 11:08:27 +0000
commitaedfac0ec957351085723e56204c4a54adaf089d (patch)
tree503acabc1c43a65ac6911adf51904ed5cf9e3a08 /gcc/cp
parent99c9c69acb9150b1b93bb86ec4ab0a65c8416c36 (diff)
downloadgcc-aedfac0ec957351085723e56204c4a54adaf089d.tar.gz
re PR c++/29001 (ICE on invalid return from operator new)
/cp 2007-07-24 Paolo Carlini <pcarlini@suse.de> PR c++/29001 * typeck.c (check_return_expr): Do not pass a null argument to null_ptr_cst_p. 2007-07-24 Paolo Carlini <pcarlini@suse.de> PR c++/32561 * decl.c (redeclaration_error_message): Call DECL_ANON_UNION_VAR_P only on VAR_DECL. /testsuite 2007-07-24 Paolo Carlini <pcarlini@suse.de> PR c++/29001 * g++.dg/init/new22.C: New. 2007-07-24 Paolo Carlini <pcarlini@suse.de> PR c++/32561 * g++.dg/template/crash67.C: New. From-SVN: r126873
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog12
-rw-r--r--gcc/cp/decl.c4
-rw-r--r--gcc/cp/typeck.c2
3 files changed, 15 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 39da6aaf3ff..f0ea30b7a8b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,15 @@
+2007-07-24 Paolo Carlini <pcarlini@suse.de>
+
+ PR c++/29001
+ * typeck.c (check_return_expr): Do not pass a null argument
+ to null_ptr_cst_p.
+
+2007-07-24 Paolo Carlini <pcarlini@suse.de>
+
+ PR c++/32561
+ * decl.c (redeclaration_error_message): Call DECL_ANON_UNION_VAR_P
+ only on VAR_DECL.
+
2007-07-22 Nathan Sidwell <nathan@codesourcery.com>
PR c++/32839
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 8b6684c2e30..e3c70a5c439 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -2195,8 +2195,8 @@ redeclaration_error_message (tree newdecl, tree olddecl)
union { int i; };
is invalid. */
- if (DECL_ANON_UNION_VAR_P (newdecl)
- || DECL_ANON_UNION_VAR_P (olddecl))
+ if ((TREE_CODE (newdecl) == VAR_DECL && DECL_ANON_UNION_VAR_P (newdecl))
+ || (TREE_CODE (olddecl) == VAR_DECL && DECL_ANON_UNION_VAR_P (olddecl)))
return "redeclaration of %q#D";
/* If at least one declaration is a reference, there is no
conflict. For example:
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 7a1a725b69a..51deeb29444 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -6639,7 +6639,7 @@ check_return_expr (tree retval, bool *no_warning)
|| DECL_OVERLOADED_OPERATOR_P (current_function_decl) == VEC_NEW_EXPR)
&& !TYPE_NOTHROW_P (TREE_TYPE (current_function_decl))
&& ! flag_check_new
- && null_ptr_cst_p (retval))
+ && retval && null_ptr_cst_p (retval))
warning (0, "%<operator new%> must not return NULL unless it is "
"declared %<throw()%> (or -fcheck-new is in effect)");