diff mbox

[c++] : Fix PR c++/64106 ICE on valid code

Message ID CAEwic4ZpUxhBoO2pdmb0SEArHA8n2gxOraTS2Z5z3ruSrJUX_A@mail.gmail.com
State New
Headers show

Commit Message

Kai Tietz Dec. 4, 2014, 3:28 p.m. UTC
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

Comments

Jason Merrill Dec. 4, 2014, 7:37 p.m. UTC | #1
My patch from yesterday fixed this bug.

         PR c++/64080
         * constexpr.c (cxx_eval_store_expression): Handle non-decl store
         targets.

Jason
Marek Polacek Dec. 4, 2014, 8:05 p.m. UTC | #2
On Thu, Dec 04, 2014 at 02:37:54PM -0500, Jason Merrill wrote:
> My patch from yesterday fixed this bug.
> 
>         PR c++/64080
>         * constexpr.c (cxx_eval_store_expression): Handle non-decl store
>         targets.

I don't see such a patch neither on ML nor in git.

	Marek
Jason Merrill Dec. 4, 2014, 8:36 p.m. UTC | #3
On 12/04/2014 03:05 PM, Marek Polacek wrote:
> On Thu, Dec 04, 2014 at 02:37:54PM -0500, Jason Merrill wrote:
>> My patch from yesterday fixed this bug.
>>
>>          PR c++/64080
>>          * constexpr.c (cxx_eval_store_expression): Handle non-decl store
>>          targets.
>
> I don't see such a patch neither on ML nor in git.

Oops, I haven't actually checked it in yet!

Jason
diff mbox

Patch

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));
+}