[{"id":3677383,"web_url":"http://patchwork.ozlabs.org/comment/3677383/","msgid":"<ad4d311b-8012-4fa5-8432-794bc9d191e0@redhat.com>","list_archive_url":null,"date":"2026-04-14T20:04:49","subject":"Re: [PATCH] c++: Fix up constexpr EH handling of TARGET_EXPR\n temporaries [PR124755]","submitter":{"id":4337,"url":"http://patchwork.ozlabs.org/api/people/4337/","name":"Jason Merrill","email":"jason@redhat.com"},"content":"On 4/14/26 3:08 AM, Jakub Jelinek wrote:\n> Hi!\n> \n> The following testcase is incorrectly rejected with spurious error about\n> <anonymous> used outside of its lifetime.\n> We constant evaluate\n>      <<cleanup_point <<< Unknown tree: expr_stmt\n>        (void) (n = TARGET_EXPR <D.2693, foo (m)>, n + D.2693) >>>>>;\n> in a loop, D.2693 is integral TARGET_EXPR_SLOT and foo throws in the second\n> or later iteration.  Because D.2693 is not is_complex nor has\n> aggregate/vector type, we don't ctx->global->put_value (slot, something)\n> until the TARGET_EXPR_INITIAL evaluation successfully finishes, at which\n> point we ctx->save_exprs->safe_push (slot); and\n> ctx->global->put_value (slot, r); Because of the save_exprs push, the\n> CLEANUP_POINT_EXPR handling then\n>          /* Forget SAVE_EXPRs and TARGET_EXPRs created by this\n>             full-expression.  */\n>          for (tree save_expr : save_exprs)\n>            destroy_value_checked (ctx, save_expr, non_constant_p);\n> and that ctx->global->put_value (slot, void_node); (i.e. marks it out of\n> lifetime).  In the second iteration, we again don't call put_value on the\n> slot early, notice TARGET_EXPR_INITIAL evaluation throws, still\n> ctx->save_exprs->safe_push (slot); but then return.  That means\n> the remembered value is still void_node and so destroy_value_checked\n> complains.\n> \n> The following patch fixes that by calling put_value in the case where\n> we know we haven't changed it yet (i.e. it is not is_complex and it doesn't\n> have aggregate/vector type), so that destroy_value_checked doesn't complain.\n> \n> Boptstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?\n\nIt seems simpler to remove the if (is_complex) from the earlier put(null)?\n\n> 2026-04-14  Jakub Jelinek  <jakub@redhat.com>\n> \n> \tPR c++/124755\n> \t* constexpr.cc (cxx_eval_constant_expression): If TARGET_EXPR_INITIAL\n> \tthrows and !is_complex and type is neither aggregate nor vector,\n> \tcall ctx->global->put_value (slot, NULL) before returning.\n> \n> \t* g++.dg/cpp26/constexpr-eh19.C: New test.\n> \n> --- gcc/cp/constexpr.cc.jj\t2026-04-03 20:46:22.849229712 +0200\n> +++ gcc/cp/constexpr.cc\t2026-04-13 16:17:30.760424372 +0200\n> @@ -9504,7 +9504,16 @@ cxx_eval_constant_expression (const cons\n>   \tif (ctx->save_exprs)\n>   \t  ctx->save_exprs->safe_push (slot);\n>   \tif (*jump_target)\n> -\t  return NULL_TREE;\n> +\t  {\n> +\t    if (!is_complex\n> +\t\t&& !(AGGREGATE_TYPE_P (type) || VECTOR_TYPE_P (type)))\n> +\t      /* If TARGET_EXPR_INITIAL throws exception and slot's value\n> +\t\t has not been changed yet, CLEANUP_POINT_EXPR handling\n> +\t\t could see there void_node from a previous evaluation\n> +\t\t and complain.  */\n> +\t      ctx->global->put_value (slot, NULL_TREE);\n> +\t    return NULL_TREE;\n> +\t  }\n>   \tif (!is_complex)\n>   \t  {\n>   \t    r = unshare_constructor (r);\n> --- gcc/testsuite/g++.dg/cpp26/constexpr-eh19.C.jj\t2026-04-13 16:22:53.086944490 +0200\n> +++ gcc/testsuite/g++.dg/cpp26/constexpr-eh19.C\t2026-04-13 16:23:15.592561870 +0200\n> @@ -0,0 +1,33 @@\n> +// PR c++/124755\n> +// { dg-do compile { target c++26 } }\n> +\n> +constexpr int\n> +foo (int a)\n> +{\n> +  return a ? throw 1 : 0;\n> +}\n> +\n> +consteval int\n> +bar ()\n> +{\n> +  int n = 0;\n> +  int a[] = { 0, 1 };\n> +  for (int m : a)\n> +    n += foo (m);\n> +  return n;\n> +}\n> +\n> +consteval int\n> +baz ()\n> +{\n> +  try\n> +    {\n> +      return bar ();\n> +    }\n> +  catch (...)\n> +    {\n> +      return -1;\n> +    }\n> +}\n> +\n> +static_assert (baz () == -1);\n> \n> \tJakub\n>","headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=RrMHHfvK;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=RrMHHfvK","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","sourceware.org; spf=pass smtp.mailfrom=redhat.com","server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.133.124"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fwFdP5Rnrz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 06:05:44 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 7EF894BA2E11\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2026 20:05:42 +0000 (GMT)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by sourceware.org (Postfix) with ESMTP id 1C6AD4BA5439\n for <gcc-patches@gcc.gnu.org>; Tue, 14 Apr 2026 20:05:04 +0000 (GMT)","from mail-qk1-f199.google.com (mail-qk1-f199.google.com\n [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-86-uy2-nHGbPTSDRDr6NpaswQ-1; Tue, 14 Apr 2026 16:04:53 -0400","by mail-qk1-f199.google.com with SMTP id\n af79cd13be357-8dacf883e77so1168164285a.2\n for <gcc-patches@gcc.gnu.org>; Tue, 14 Apr 2026 13:04:53 -0700 (PDT)","from [192.168.50.130]\n (130-44-146-247.s12789.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com.\n [130.44.146.247]) by smtp.gmail.com with ESMTPSA id\n af79cd13be357-8e3a0b31b43sm239605085a.4.2026.04.14.13.04.50\n (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n Tue, 14 Apr 2026 13:04:51 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 7EF894BA2E11","OpenDKIM Filter v2.11.0 sourceware.org 1C6AD4BA5439"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 1C6AD4BA5439","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 1C6AD4BA5439","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776197104; cv=none;\n b=dbVK10HVcyEfIPRkytv8jH+DhyDFIVvrG5I69MPWi3BpmZu8YWac5qmVVPijQLI/5nb8o4e3nFGF5Ou2eyepwP/PmiH2CASzXcz42oulEoxnGlofK74p/mb1fXKwsmr9wbuyYwxlGVDd9eeTKZ19p5GLLZGOIthgemitc7gBO+I=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776197104; c=relaxed/simple;\n bh=C74CpzZRJ+y8MeHeCLAmaPZksCgLdDuHghNPCRDCuNk=;\n h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From;\n b=JDSjl/L5fQo0uTndfJRK902BZzEVA0if/p5/t9w6YQmRNvZ2LgNIgiaX0W84HhNnhhjCHMW2JqDL5zzkE+tMNgCsiLgarloabiEkuV2ySJD5Ez1hJ5Nx85Kn50BEdj9rlntc/CWTFrVJl7bYd4pRVi4lbNYwgcE5VNOyNyzDXPY=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776197103;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=grxYHxxVAQujBqTS8P1Zqqn8YjKDWvsXCGgxgx7rRRI=;\n b=RrMHHfvKNWlP+rgiR2EYRO01s59nG98KiJWNc8SbhHqK0EvFOpMQ2UwaM2ywk6Zplc5L9J\n k0xhjs8oAxfCxYU8KwBV3Gdab3YnFN/br6O5h2OP66jYABsRyfVstnNGY6/ZO6r70RlJ+V\n GyWFLeOz99Yue2ig/Zj1AktSiyM5orM=","X-MC-Unique":"uy2-nHGbPTSDRDr6NpaswQ-1","X-Mimecast-MFC-AGG-ID":"uy2-nHGbPTSDRDr6NpaswQ_1776197093","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776197093; x=1776801893;\n h=content-transfer-encoding:in-reply-to:from:content-language\n :references:cc:to:subject:user-agent:mime-version:date:message-id\n :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=grxYHxxVAQujBqTS8P1Zqqn8YjKDWvsXCGgxgx7rRRI=;\n b=EruEsHHD1Sx0byxWYCLv7L1bsoq8mwxOPt3y4HC4O45HDV+USxf9Db1lCHTEd/vh6Q\n GiLmqJY/zz+qFM5UQ8bMPHK0UleJWBpHKkiWf/B5z7g9W11pddDFGq+XYJNS4pdh4Yh2\n Qs8GG8+rxtwxFwR77xvCGbDP5rftw505zTzMCvYSNUwMmJF+DOYQGLykGPj8xwT+XA5J\n W+OLreZbN7NgO3qQQbiKyLMRdjFbPf+ZDJxGezOwIDdy0J32ViVCRKSjbOvfKCl4xUvm\n wNXphOpPWG4xXg7bU0MtD3FVjQtTVTNhr6+KBO2naVFB8sJYByOr7JSbEKGYUV3dhy/e\n 84Xw==","X-Gm-Message-State":"AOJu0YxKE94BxC9osXzazqRoqmkla7JFcUPlEsX//xviaHabrjWVpwTh\n RpJNlOHr5iotsrd73ViLkoMhI5sMoebatqFb1YgBZgDCuQGlBz3VLezWGvTTriECVuhTcM/JGRe\n lZh4BdTXnShTqcsWsanvDgmvAYhp8myNrPFFsfubMEamkc3zRl0Sua/YB1Fw=","X-Gm-Gg":"AeBDievcoJt4J0zQynSQIZkxapw+dVrgtVFVp4HauaixRNFIdaBlSXImphCsCkKY+yh\n x7coYwBT/TUeFXxAO7VV5SXHZX7VqmoPQUEYv6XqdMl9YVRmqMFyBlZuAzeXznvtJUyFle+opeM\n w9FuBHTWxy6tnrmYIyuen9UNeRjdjFTW6N9fKwYHfclt7YmH0NY+2oz+/taZSqiKWP7tzuF9z+i\n p+iu8aswFkzjanHoXv7Yl9D22v7DSiXbUDiU7Qt2HKe2CP/PTNxrRvBCNayD7t3pajFMT8ng9NW\n OjX6Yljju78B8QDijEwodo62/IueUFXmYE/Sbvaggp0VMDdyfP4cOX/oE1oOw8+1kH1uGBhZCVn\n fV/OpvLH3yRbvhfchgv1/jM6V2IIe7iYTSnxB6eaPYlwi9MQ5aVsdGYP14Kw5kHb8fNTII07SYL\n tmfzgSye3EIRjAIu2OSge1M5MduRycOBoDkUlLle3WaQ==","X-Received":["by 2002:a05:620a:4041:b0:8d8:3a48:35e7 with SMTP id\n af79cd13be357-8ddcfcb2ebemr2757753485a.48.1776197092479;\n Tue, 14 Apr 2026 13:04:52 -0700 (PDT)","by 2002:a05:620a:4041:b0:8d8:3a48:35e7 with SMTP id\n af79cd13be357-8ddcfcb2ebemr2757745585a.48.1776197091768;\n Tue, 14 Apr 2026 13:04:51 -0700 (PDT)"],"Message-ID":"<ad4d311b-8012-4fa5-8432-794bc9d191e0@redhat.com>","Date":"Tue, 14 Apr 2026 16:04:49 -0400","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH] c++: Fix up constexpr EH handling of TARGET_EXPR\n temporaries [PR124755]","To":"Jakub Jelinek <jakub@redhat.com>","Cc":"gcc-patches@gcc.gnu.org","References":"<ad3oBsKzdenydbTa@tucnak>","From":"Jason Merrill <jason@redhat.com>","In-Reply-To":"<ad3oBsKzdenydbTa@tucnak>","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"I9RHF7X8QCUFu8o5mEbBFqIPWzG1E9rsV3ckUqxjPMo_1776197093","X-Mimecast-Originator":"redhat.com","Content-Language":"en-US","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"}},{"id":3677394,"web_url":"http://patchwork.ozlabs.org/comment/3677394/","msgid":"<ad6jN93JnIe15uI2@tucnak>","list_archive_url":null,"date":"2026-04-14T20:27:35","subject":"Re: [PATCH] c++: Fix up constexpr EH handling of TARGET_EXPR\n temporaries [PR124755]","submitter":{"id":671,"url":"http://patchwork.ozlabs.org/api/people/671/","name":"Jakub Jelinek","email":"jakub@redhat.com"},"content":"On Tue, Apr 14, 2026 at 04:04:49PM -0400, Jason Merrill wrote:\n> It seems simpler to remove the if (is_complex) from the earlier put(null)?\n\nWouldn't that break pretty much all the aggregate/vector TARGET_EXPR\nhandling?\n\nI mean, we have there:\n    case TARGET_EXPR:\n...\n        if ((AGGREGATE_TYPE_P (type) || VECTOR_TYPE_P (type)))\n\t  {\n...\n            new_ctx.object = slot;\n            ctx->global->put_value (new_ctx.object, new_ctx.ctor);\n            ctx = &new_ctx;\n\t  }\n\n        /* If the initializer is complex, evaluate it to initialize slot.  */\n        bool is_complex = target_expr_needs_replace (t);\n        if (is_complex)\n          /* In case no initialization actually happens, clear out any\n             void_node from a previous evaluation.  */\n          ctx->global->put_value (slot, NULL_TREE);\n\nExcept for one rare case (0.01%, g++.dg/cpp0x/constexpr-prvalue5.C (X::X))\nwhen AGGREGATE_TYPE_P (type) || VECTOR_TYPE_P (type) is true, is_complex\nis false, so removing if (is_complex) would make the\nctx->global->put_value (new_ctx.object, new_ctx.ctor); earlier completely\nuseless.  I don't know how it works if it works for the\nconstexpr-prvalue5.C (X::X) case where it is aggregate and is_complex.\n\nIf you mean I should\n-       if (is_complex)\n+       if (is_complex || !(AGGREGATE_TYPE_P (type) || VECTOR_TYPE_P (type)))\nI can certainly do it, but thought the posted version is faster (doesn''t\nput a value in the usual case when it is overwritten soon after) and safer\n(because it clearly can't affect anything but C++26 constexpr exceptions\ncode).\n\n\tJakub","headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=TvhDtDCb;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=TvhDtDCb","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","sourceware.org; spf=pass smtp.mailfrom=redhat.com","server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.129.124"],"Received":["from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fwG7N4d76z1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 06:28:16 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id D11944BA2E2D\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2026 20:28:09 +0000 (GMT)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by sourceware.org (Postfix) with ESMTP id 9353A4BA543C\n for <gcc-patches@gcc.gnu.org>; Tue, 14 Apr 2026 20:27:42 +0000 (GMT)","from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-507-l-zGBOYZOmyBnFCygkOQEw-1; Tue,\n 14 Apr 2026 16:27:40 -0400","from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 22A2C1956095\n for <gcc-patches@gcc.gnu.org>; Tue, 14 Apr 2026 20:27:40 +0000 (UTC)","from tucnak.zalov.cz (unknown [10.44.33.129])\n by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with\n ESMTPS\n id 670CF19560B1; Tue, 14 Apr 2026 20:27:39 +0000 (UTC)","from tucnak.zalov.cz (localhost [127.0.0.1])\n by tucnak.zalov.cz (8.18.1/8.18.1) with ESMTPS id 63EKRat93055164\n (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);\n Tue, 14 Apr 2026 22:27:36 +0200","(from jakub@localhost)\n by tucnak.zalov.cz (8.18.1/8.18.1/Submit) id 63EKRZIR3055163;\n Tue, 14 Apr 2026 22:27:35 +0200"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org D11944BA2E2D","OpenDKIM Filter v2.11.0 sourceware.org 9353A4BA543C"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 9353A4BA543C","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 9353A4BA543C","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776198462; cv=none;\n b=dgd3PSGsPsrjPvI3dNLvgoX5D8U0jSOQPGG9vvSeXgb0YppOYZqapVB0+5AE+Rvk6jjmphfIFOcMFhjg101jGHa98RmQ+o5RDFwyj2NFLH6OEPolto0Nv4Z+V4A+Wc7bJdrSAWWWztNrIuGJXvy0mqYsF57N64Upx87JYbNpnZI=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776198462; c=relaxed/simple;\n bh=Dn+8Oerw13LngtlJw0SuCGPRmTLBX1kTW0Q73LPNN5g=;\n h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;\n b=j8tsbO6CV622Ydpfx61v8r2tEIKEskAJlPVradC1EwxcSlhYhyCT7t01DQUGssvpepFhl8wNgDkIlUZl0UpHW9PofMyqLDN0vzCqu6iOdWejxNySzQHiysl2ya53O8r+6ToELzMNTwyr5IFUN11npnjT9unm7ouqJ/wjfZxbvQc=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776198462;\n h=from:from:reply-to:reply-to:subject:subject:date:date:\n message-id:message-id:to:to:cc:cc:mime-version:mime-version:\n content-type:content-type:in-reply-to:in-reply-to:  references:references;\n bh=OIieFXoHDCKthig9G01KqJXfEGZUOaGfQH8mZJGoPYg=;\n b=TvhDtDCbfiloSiy3uA3kZq1XDWdTVgGvM67uMqyKhoD5bSdTqSKxnneqY4JKfntaxJVsLf\n BdUMHqHucdPJYBtNDconfLeBJcXvAh6SpBpq5LvmEPm3JSAaFKjCWAHPl9u+GrlCtw8Yho\n dJSbRse28mSYlUUAk1bMGxZwLdU1Tjw=","X-MC-Unique":"l-zGBOYZOmyBnFCygkOQEw-1","X-Mimecast-MFC-AGG-ID":"l-zGBOYZOmyBnFCygkOQEw_1776198460","Date":"Tue, 14 Apr 2026 22:27:35 +0200","From":"Jakub Jelinek <jakub@redhat.com>","To":"Jason Merrill <jason@redhat.com>","Cc":"gcc-patches@gcc.gnu.org","Subject":"Re: [PATCH] c++: Fix up constexpr EH handling of TARGET_EXPR\n temporaries [PR124755]","Message-ID":"<ad6jN93JnIe15uI2@tucnak>","References":"<ad3oBsKzdenydbTa@tucnak>\n <ad4d311b-8012-4fa5-8432-794bc9d191e0@redhat.com>","MIME-Version":"1.0","In-Reply-To":"<ad4d311b-8012-4fa5-8432-794bc9d191e0@redhat.com>","X-Scanned-By":"MIMEDefang 3.0 on 10.30.177.12","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"h1wwyFuUT1L67H3WrGkHHLFJvt-b1LZBHPRnWolRMuk_1776198460","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Reply-To":"Jakub Jelinek <jakub@redhat.com>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"}},{"id":3677733,"web_url":"http://patchwork.ozlabs.org/comment/3677733/","msgid":"<ae301cb5-d952-4d77-b723-118aabfdb8b1@redhat.com>","list_archive_url":null,"date":"2026-04-15T15:23:53","subject":"Re: [PATCH] c++: Fix up constexpr EH handling of TARGET_EXPR\n temporaries [PR124755]","submitter":{"id":4337,"url":"http://patchwork.ozlabs.org/api/people/4337/","name":"Jason Merrill","email":"jason@redhat.com"},"content":"On 4/14/26 4:27 PM, Jakub Jelinek wrote:\n> On Tue, Apr 14, 2026 at 04:04:49PM -0400, Jason Merrill wrote:\n>> It seems simpler to remove the if (is_complex) from the earlier put(null)?\n> \n> Wouldn't that break pretty much all the aggregate/vector TARGET_EXPR\n> handling?\n> \n> I mean, we have there:\n>      case TARGET_EXPR:\n> ...\n>          if ((AGGREGATE_TYPE_P (type) || VECTOR_TYPE_P (type)))\n> \t  {\n> ...\n>              new_ctx.object = slot;\n>              ctx->global->put_value (new_ctx.object, new_ctx.ctor);\n>              ctx = &new_ctx;\n> \t  }\n\nGood point, it would need to be an else to this if.\n\n>          /* If the initializer is complex, evaluate it to initialize slot.  */\n>          bool is_complex = target_expr_needs_replace (t);\n>          if (is_complex)\n>            /* In case no initialization actually happens, clear out any\n>               void_node from a previous evaluation.  */\n>            ctx->global->put_value (slot, NULL_TREE);\n> \n> Except for one rare case (0.01%, g++.dg/cpp0x/constexpr-prvalue5.C (X::X))\n> when AGGREGATE_TYPE_P (type) || VECTOR_TYPE_P (type) is true, is_complex\n> is false, so removing if (is_complex) would make the\n> ctx->global->put_value (new_ctx.object, new_ctx.ctor); earlier completely\n> useless.  I don't know how it works if it works for the\n> constexpr-prvalue5.C (X::X) case where it is aggregate and is_complex.\n> \n> If you mean I should\n> -       if (is_complex)\n> +       if (is_complex || !(AGGREGATE_TYPE_P (type) || VECTOR_TYPE_P (type)))\n> I can certainly do it, but thought the posted version is faster (doesn''t\n> put a value in the usual case when it is overwritten soon after) and safer\n> (because it clearly can't affect anything but C++26 constexpr exceptions\n> code).\nBut more complicated in terms of keeping conditions in sync.  Well, OK \neither way.\n\nJason","headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=MAZFZ+b3;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=MAZFZ+b3","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","sourceware.org; spf=pass smtp.mailfrom=redhat.com","server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.129.124"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fwlLg117Pz1yHc\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 01:24:41 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id D43504BA2E35\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 15:24:39 +0000 (GMT)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by sourceware.org (Postfix) with ESMTP id 010414BA2E28\n for <gcc-patches@gcc.gnu.org>; Wed, 15 Apr 2026 15:23:59 +0000 (GMT)","from mail-qv1-f72.google.com (mail-qv1-f72.google.com\n [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-315-aKMjEoOFPxuNFagKv05PvQ-1; Wed, 15 Apr 2026 11:23:58 -0400","by mail-qv1-f72.google.com with SMTP id\n 6a1803df08f44-8a8ea3f1becso188911946d6.0\n for <gcc-patches@gcc.gnu.org>; Wed, 15 Apr 2026 08:23:58 -0700 (PDT)","from [192.168.50.130]\n (130-44-146-247.s12789.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com.\n [130.44.146.247]) by smtp.gmail.com with ESMTPSA id\n af79cd13be357-8e4f2dfb3d7sm136694285a.36.2026.04.15.08.23.54\n (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n Wed, 15 Apr 2026 08:23:54 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org D43504BA2E35","OpenDKIM Filter v2.11.0 sourceware.org 010414BA2E28"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 010414BA2E28","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 010414BA2E28","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776266640; cv=none;\n b=bkBYecWp2+SGavI4QwLIfCtbZ350gnc99gMyiPTV4zJHmDWo1lP03KedomBvb4/1ko3mgwm0V9p8jm1i9YX0aVaAuoJ/CZ5+ZEOHopYgYnzfq16NyCNndlEBDPw6CIA5d1Xp++iUNMy1KpUPeufjjqxlJmZQAVgd4xdyl7Mwesg=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776266640; c=relaxed/simple;\n bh=ZhqXv8gi8dtOE631kia1JcfVGp8++GcrpHzzvstskcY=;\n h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From;\n b=kXlIwYPhxgkVVCbwwjTEqGud/KkCw1TGM2fjvNkEUeDae2p/t3f9lcPFFw+VoGMrNrw2O9QLai0lzONwDRuwUX+2iEw+5FjtToR98pMkVL3E+tUDnnZzShqyXTCgvt5its/bSocG3OvwqeWW6i10B7KRnUDmYnxPwbBUaYs9cOU=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776266639;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=KhlyoalTWHTECMOvpZ2sv+vmhSRjPEY2KIjao7TKkec=;\n b=MAZFZ+b3f9ploVSy5yQoAWGyW5vjPOfLVuUpG59jBfT1scGqD7Nxkg6Kw4VmwUy+Y0BVE/\n ZBh8l750DDpOhi3yCIE5rjqg2IMTYz+QaZ+dpFZ9YPQDiVNGkEbOWSkFyyhnbZFgEzia0I\n HzwLTBSdz4xkHA0KCUoYelX/MrzTEi8=","X-MC-Unique":"aKMjEoOFPxuNFagKv05PvQ-1","X-Mimecast-MFC-AGG-ID":"aKMjEoOFPxuNFagKv05PvQ_1776266638","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776266638; x=1776871438;\n h=content-transfer-encoding:in-reply-to:from:content-language\n :references:cc:to:subject:user-agent:mime-version:date:message-id\n :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=KhlyoalTWHTECMOvpZ2sv+vmhSRjPEY2KIjao7TKkec=;\n b=B39iLB7NNIvhaFSOWGS07S4nQDpdnBoRzw2Zl5aIaivxLUhCIDv5+D/e5GthzxurMP\n rV6/LFQUl2HqG6uw2QrSl0eMJWRnWby/i7pjTNedMPgs1TMiKym+IShOYWnlkSlqLING\n 7OkZrJbr4QoJkaaZ/XEKkx3mVNaH2OMn+qH0lUpRtcdW+QaRtGDUqLIhsLY9sV6250X1\n fNl7as3DhduIeFF4okT1hdIxkzq7P8w0gO6dlM6S8ng348uPjQEHjuL6IJLstXLjoI7v\n xejdfHYq6xfE3QiwMA6bIC9L6LOpLOEZMvqsf0ccxtch13TsLaTyPnUI+ZzpS33cFz3Y\n lRMg==","X-Gm-Message-State":"AOJu0YzmWkdIFxtUpwD62uUtiheUiNjLziAh4kMZzd7GmyaCU9nlTSty\n mZ69Hoh3X+ubChPuV24mfFo7uHT3np9f/sPfcBeFy9qUCFCImX849JB3+SHiY0GiTa58xmS2lw3\n f8aS/4lI3lZNRUdBeaxNRhiWGk+2gDVwFUmQWXmBc5OMsGF78sp4ZlkkWdF8=","X-Gm-Gg":"AeBDiesFDopoErTkVYy13qtJbATIeiaD7w8PyS4HYfKscxMk9e7lJ02JG09SHaCWiY/\n GN3OsISFVvmN4p68WfchcEJxOrTaHZbtNUodgJbk6Tpa3rDKbc036kOvZ9AA8N0MNHACRjTX0ov\n ZwqdSgyus7THcoXRcEdJTGevo6vWn5ncbMXj7hXdQ5jVHYhZi4+4XLYKXu8LqXJ4A/KI1q7RE6y\n ejXdD/O6WzThnJ1OS0PJE2sUMc/n9BqJiMOZE2sEoVIrGLF9ELC7fV73AAVhAWWUxQ1HdnBtEMk\n OVMmOntGtxaFpspjG8MBmDCDwjF3RebS3k5Zj3ui86YehT+Sr7+VSRZK1uG4FB0cxay3F/NxhJ+\n Lg5h7mCBj5b9jHtdh6G8HHwU5eJIohB4jJcKM8OPdpbTBC6jY1/ar/u5UqQQRS5XLpkptRvu0j9\n 2cw4osJuZHYmHaE8ZvIiBRb5QzmpZufhH0afidJkNTAA==","X-Received":["by 2002:a05:620a:4481:b0:8cd:942e:82dc with SMTP id\n af79cd13be357-8ddcf1b80d5mr3146104385a.41.1776266637541;\n Wed, 15 Apr 2026 08:23:57 -0700 (PDT)","by 2002:a05:620a:4481:b0:8cd:942e:82dc with SMTP id\n af79cd13be357-8ddcf1b80d5mr3146098485a.41.1776266636986;\n Wed, 15 Apr 2026 08:23:56 -0700 (PDT)"],"Message-ID":"<ae301cb5-d952-4d77-b723-118aabfdb8b1@redhat.com>","Date":"Wed, 15 Apr 2026 11:23:53 -0400","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH] c++: Fix up constexpr EH handling of TARGET_EXPR\n temporaries [PR124755]","To":"Jakub Jelinek <jakub@redhat.com>","Cc":"gcc-patches@gcc.gnu.org","References":"<ad3oBsKzdenydbTa@tucnak>\n <ad4d311b-8012-4fa5-8432-794bc9d191e0@redhat.com> <ad6jN93JnIe15uI2@tucnak>","From":"Jason Merrill <jason@redhat.com>","In-Reply-To":"<ad6jN93JnIe15uI2@tucnak>","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"mZJEGMPcxQHacXSRJORAmvXCiQntSFb5U5glSO3gclI_1776266638","X-Mimecast-Originator":"redhat.com","Content-Language":"en-US","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"}}]