From: Jason Merrill <jason@redhat.com>
To: Richard Biener <rguenther@suse.de>, Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] c++/114409 - ANNOTATE_EXPR and templates
Date: Wed, 10 Apr 2024 13:25:13 -0400 [thread overview]
Message-ID: <b32dd72e-034a-4c42-aa01-6755f00dbf1b@redhat.com> (raw)
In-Reply-To: <7o667262-s25q-q265-123s-355r6729p937@fhfr.qr>
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
prev parent reply other threads:[~2024-04-10 17:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-10 16:43 Richard Biener
2024-04-10 16:50 ` Jakub Jelinek
2024-04-10 17:10 ` Richard Biener
2024-04-10 17:24 ` Jakub Jelinek
2024-04-10 17:25 ` Jason Merrill [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b32dd72e-034a-4c42-aa01-6755f00dbf1b@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=rguenther@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).