From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 40CC43891C22 for ; Wed, 10 Apr 2024 17:25:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 40CC43891C22 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 40CC43891C22 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712769929; cv=none; b=R5jMFsXm/TdNqBwrDlAL6FUV25IxiWD39WXLLRzc/2j5IZg0dXdhQgj/0j6euvjGfPPevHgtAsfbtRi4vn2Vwj8vpLsQRmJ1Zc5iicdFcYZIth/NeU56avB46c0LEglfz2oH56zvTdclEuhQOCSs82ZSmDVJMP4nybd4EV+wIpE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712769929; c=relaxed/simple; bh=lmHmHHEhsAqplAoXWEAiO6NYBDW0ACuUGr5aTdsJy2w=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=vRfZeAsd6PCOwWzhqiISw1sR8RFU91ryIC3BAxLqfN+h/1Zbf5z473szcSZizhjf5UEQQgPR9MgQYDi+0UaM8F5q4R2eac6MmKlQuMg5aleZzzO/TlVWhv3bXC+PZq+a4sJmDtOi6H0C6zNmA10Wj59obtD/+xkC15n2G0W7XCA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712769917; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/Mg5jUzi4k/FY8nxv9pGf8xqKYaQkot6w7rhPzikoek=; b=LK2dsVw3Do1DeRm0H3u8z9zXZMEJwth1PdElvrTLs4PhQGBxl+FhwacVgbo3gOBKn9prCg HZLj+dzjK/DopR/JnirpuQNy7fcjSyr3u2ZxTOPXtKhOMCaZ/LOmfmaMHKCx5afU8jg2k8 6rO8/x/kXQMBhRxlpxj0QCmIXXDVBWM= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-64-D4vCKGjwOaWK-Pg0HLvfBQ-1; Wed, 10 Apr 2024 13:25:15 -0400 X-MC-Unique: D4vCKGjwOaWK-Pg0HLvfBQ-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-78d6b7d1f4fso201345685a.1 for ; Wed, 10 Apr 2024 10:25:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712769915; x=1713374715; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/Mg5jUzi4k/FY8nxv9pGf8xqKYaQkot6w7rhPzikoek=; b=d/+frHRRq14JmXMyNMxikZJVtK9Eh51Z6zmV65o8KJYLeGiP9NKWVHz0X2CT5TZpNB GAK/BSXK/36XAVUD/UfyeUZJCo3ppnQ0ihBKpFHgeB0qZl6IdLdc2JSDNfbgchqDNPsf Qgb0BitaBLtkN3fDSji6pknpHKOJ0Nx75SF8PNccE8dA/cKFBkfn4wQTg3+4kCGwVCLi 7TL5s8gaCAjsK8frcYjGnLm+ZSYDU0Cl7BgZYc1Nfhkhob4pMU2DRxvcOqoxcZjfhmFN jIvfh+P9z+cQ7lbszj3f6QM39S+2h24NEFqs6fJe6WxBI15FUSv1P16K783JMh+t3a5j 0s5g== X-Gm-Message-State: AOJu0YwQMXkXJKW4dhmm3/DHVofBN89gzGeak+uYOTWD0XooNlvAAf4k QAYOw7DKKDkEllG/xbqJTTaAJ1AqD+UxBZFCnEkhscuPWXqC4B8LBSOMELX8tOvBS38zitfg7NI Tf6D0B6dXW0aGgKjSnO3Es30Z96b9powcz05VIdxn759b185TC6RppdE= X-Received: by 2002:a37:ef13:0:b0:78d:7894:8ba7 with SMTP id j19-20020a37ef13000000b0078d78948ba7mr2509193qkk.53.1712769915273; Wed, 10 Apr 2024 10:25:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFUnPvHlTIcKtwdPfTfO6dNZow5YfR2yttOq/CFZak6hyamrleeM6AdbdYKfVKK3tlXrHcTjw== X-Received: by 2002:a37:ef13:0:b0:78d:7894:8ba7 with SMTP id j19-20020a37ef13000000b0078d78948ba7mr2509174qkk.53.1712769914942; Wed, 10 Apr 2024 10:25:14 -0700 (PDT) Received: from [192.168.1.130] (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id i11-20020a05620a144b00b0078d63b220b3sm3564248qkl.93.2024.04.10.10.25.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Apr 2024 10:25:14 -0700 (PDT) Message-ID: Date: Wed, 10 Apr 2024 13:25:13 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] c++/114409 - ANNOTATE_EXPR and templates To: Richard Biener , Jakub Jelinek Cc: gcc-patches@gcc.gnu.org References: <20240410164306.EFDB113942@imap1.dmz-prg2.suse.org> <7o667262-s25q-q265-123s-355r6729p937@fhfr.qr> From: Jason Merrill In-Reply-To: <7o667262-s25q-q265-123s-355r6729p937@fhfr.qr> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 4/10/24 13:10, Richard Biener wrote: > On Wed, 10 Apr 2024, Jakub Jelinek wrote: > >> On Wed, Apr 10, 2024 at 06:43:02PM +0200, Richard Biener wrote: >>> The following fixes a mismatch in COMPOUND_EXPR handling in >>> tsubst_expr vs tsubst_stmt where the latter allows a stmt in >>> operand zero but the former doesn't. This makes a difference >>> for the case at hand because when the COMPOUND_EXPR is wrapped >>> inside an ANNOTATE_EXPR it gets handled by tsubst_expr and when >>> not, tsubst_stmt successfully handles it and the contained >>> DECL_EXPR in operand zero. >>> >>> The following makes handling of COMPOUND_EXPR in tsubst_expr >>> consistent with that of tsubst_stmt for the operand that doesn't >>> specify the result and thus the reason we choose either or the >>> other for substing. >>> >>> Bootstrapped and tested on x86_64-unknown-linux-gnu, OK? >>> >>> Thanks, >>> Richard. >>> >>> PR c++/114409 >>> gcc/cp/ >>> * pt.cc (tsubst_expr): Recurse to COMPOUND_EXPR operand >>> zero using tsubst_stmt, when that returns NULL return >>> the subst operand one, mimicing what tsubst_stmt does. >>> >>> gcc/testsuite/ >>> * g++.dg/pr114409.C: New testcase. >> >> I've posted https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114409#c16 >> for this already and Jason agreed to that version, so I just have to test it >> tonight: >> https://gcc.gnu.org/pipermail/gcc-patches/2024-April/649165.html > > Ah, I saw the bugzilla patches and wanted this version to be sent > because I think the COMPOUND_EXPR inconsistency is odd. So Jason, > please still have a look, not necessarily because of the bug > which can be fixed in multiple ways but because of that COMPOUND_EXPR > handling oddity (there are already some cases in tsubst_expr that > explicitly recurse with tsubst_stmt). The difference between tsubst_stmt and tsubst_expr handling of COMPOUND_EXPR seems consistent with the general difference between the two functions, so I think this change isn't needed. The two existing uses of tsubst_stmt in tsubst_expr are statement-expressions (for the substatement) and transactions (strangely, non-statement transactions are handled in tsubst_stmt). Jason