This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch c++]: Fix PR c++/64106 ICE on valid code
- From: Kai Tietz <ktietz70 at googlemail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Jason Merrill <jason at redhat dot com>
- Date: Thu, 4 Dec 2014 16:28:43 +0100
- Subject: [patch c++]: Fix PR c++/64106 ICE on valid code
- Authentication-results: sourceware.org; auth=none
Hi,
this patch adds INDIRECT_REF support to cxx_eval_store_expression handling.
There is a different variant suggested by Marek, which adds additional
operand-0 to ref, which looks to me wrong.
ChangeLog gcc/cp
2014-12-04 Kai Tietz <ktietz@redhat.com>
PR c++/64106
* constexpr.c (cxx_eval_store_expression): Handle INDIRECT_REF.
ChangeLog testsuite
2014-12-04 Kai Tietz <ktietz@redhat.com>
PR c++/64106
* g++.dg/pr64106.C: New file.
Tested on x86_64-unknown-linux-gnu.
Ok for apply?
Regards,
Kai
Index: constexpr.c
===================================================================
--- constexpr.c (Revision 218142)
+++ constexpr.c (Arbeitskopie)
@@ -2486,7 +2550,9 @@ cxx_eval_store_expression (const constexpr_ctx *ct
vec_safe_push (refs, TREE_TYPE (probe));
probe = TREE_OPERAND (probe, 0);
break;
-
+ case INDIRECT_REF:
+ probe = TREE_OPERAND (probe, 0);
+ break;
default:
object = probe;
gcc_assert (DECL_P (object));
Index: gcc/gcc/testsuite/g++.dg/pr64106.C
===================================================================
--- /dev/null
+++ gcc/gcc/testsuite/g++.dg/pr64106.C
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+
+void
+f (long &c, int &lc, char *&out)
+{
+ while (lc >= 8) *out++ = (c >> (lc -= 8));
+}