summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMeador Inge <meadori@codesourcery.com>2012-03-27 18:08:13 +0000
committerJason Merrill <jason@gcc.gnu.org>2012-03-27 14:08:13 -0400
commit9a1cb58a99604cf6291b86b20f0f9773065afab6 (patch)
tree02c9c91b4157634c7cd25912a6d58695aaf6e28c
parentab7ea426a359564da2edf11914782528e381aa9a (diff)
downloadgcc-9a1cb58a99604cf6291b86b20f0f9773065afab6.tar.gz
re PR c++/52672 (internal compiler error: in cxx_eval_indirect_ref, at cp/semantics.c:6766)
PR c++/52672 * gcc/cp/semantics.c (cxx_fold_indirect_ref): Don't attempt to fold stripped child trees that are not pointer types. From-SVN: r185890
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/semantics.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-52672.C8
4 files changed, 21 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9cd2711e0a9..0d9be4fa49d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2012-03-27 Meador Inge <meadori@codesourcery.com>
+
+ PR c++/52672
+ * semantics.c (cxx_fold_indirect_ref): Don't attempt to fold
+ stripped child trees that are not pointer types.
+
2012-03-21 Jason Merrill <jason@redhat.com>
Implement return type deduction for normal functions with -std=c++1y.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 6294e19af60..65b771f1ee2 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -7202,7 +7202,8 @@ cxx_fold_indirect_ref (location_t loc, tree type, tree op0, bool *empty_base)
sub = op0;
STRIP_NOPS (sub);
subtype = TREE_TYPE (sub);
- gcc_assert (POINTER_TYPE_P (subtype));
+ if (!POINTER_TYPE_P (subtype))
+ return NULL_TREE;
if (TREE_CODE (sub) == ADDR_EXPR)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9fdb69d7e4d..9c69953e65c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-03-27 Meador Inge <meadori@codesourcery.com>
+
+ PR c++/52672
+ * g++.dg/cpp0x/constexpr-52672.C: New testcase.
+
2012-03-27 Mike Stump <mikestump@comcast.net>
PR target/52665
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-52672.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-52672.C
new file mode 100644
index 00000000000..9f878780c7c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-52672.C
@@ -0,0 +1,8 @@
+// PR c++/52672
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+typedef unsigned long * ul_ptr;
+constexpr unsigned long a = *((ul_ptr)0x0); // { dg-error "" }
+constexpr unsigned long b = *((ul_ptr)(*((ul_ptr)0x0))); // { dg-error "" }
+constexpr unsigned long c = *((ul_ptr)*((ul_ptr)(*((ul_ptr)0x0)))); // { dg-error "" }