diff mbox

RFA (tree-cfg): PATCH for 68983 (ICE in copy constructor)

Message ID 568FDCEA.5070005@redhat.com
State New
Headers show

Commit Message

Jason Merrill Jan. 8, 2016, 3:59 p.m. UTC
On 01/08/2016 06:18 AM, Richard Biener wrote:
> On Fri, Jan 8, 2016 at 8:22 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>>> But it occurs to me that since the real problem I was trying to catch is
>>> creation of temporaries of TREE_ADDRESSABLE type in the back end, we
>>> should guard that instead.  So this patch moves the assert into assign_temp.
>>
>> FWIW create_tmp_var has a slightly stronger version:
>>
>>    gcc_assert (!TREE_ADDRESSABLE (type) && COMPLETE_TYPE_P (type));
>
> Ok with the assert changed to match that of create_tmp_var.

OK, here's what I'm checking in, along with a couple of front-end 
patches, one for the testcase in a later comment, and one to remove a no 
longer necessary workaround.

Tested x86_64-pc-linux-gnu, applying to trunk.  Second patch also 
applying to 5 and 4.9.
diff mbox

Patch

commit f2adb8a5b5117dc016b403cb697d7ad765578f87
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Jan 8 10:38:56 2016 -0500

    	* constexpr.c (cxx_eval_call_expression): Remove convert_to_void
    	workaround.

diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index bcf26a6..c6c3467 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1285,16 +1285,6 @@  cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
       ctx->values->put (new_ctx.object, ctor);
       ctx = &new_ctx;
     }
-  else if (DECL_BY_REFERENCE (DECL_RESULT (fun))
-	   && TREE_CODE (t) != AGGR_INIT_EXPR)
-    {
-      /* convert_to_void stripped our AGGR_INIT_EXPR, in which case we don't
-	 care about a constant value.  ??? we could still optimize away the
-	 call.  */
-      gcc_assert (ctx->quiet && !ctx->object);
-      *non_constant_p = true;
-      return t;
-    }
 
   bool non_constant_args = false;
   cxx_bind_parameters_in_call (ctx, t, &new_call,