From: Marek Polacek <polacek@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] c-family: ICE with -Wconversion and A ?: B [PR101030]
Date: Wed, 30 Mar 2022 10:22:57 -0400 [thread overview]
Message-ID: <YkRnwTARvIsSojJV@redhat.com> (raw)
In-Reply-To: <12d83e36-46a2-221c-4535-11025376bfd6@redhat.com>
On Tue, Mar 29, 2022 at 10:21:47PM -0400, Jason Merrill wrote:
> On 3/29/22 16:53, Marek Polacek wrote:
> > This patch fixes a crash in conversion_warning on a null expression.
> > It is null because the testcase uses the GNU A ?: B extension. We
> > could also use op0 instead of op1 in this case, but it doesn't seem
> > to be necessary.
>
> I wonder why we don't represent the extension as
>
> SAVE_EXPR(A) ? SAVE_EXPR(A) : B
>
> so we don't hit this sort of problem. But the patch is OK.
The reason there are no SAVE_EXPRs is that we don't create them
in a template: cp_save_expr:
/* There is no reason to create a SAVE_EXPR within a template; if
needed, we can create the SAVE_EXPR when instantiating the
template. Furthermore, the middle-end cannot handle C++-specific
tree codes. */
if (processing_template_decl)
return expr;
and when instantiating we see the first expression is tree_invariant_p_1
aka constant, so no SAVE_EXPR gets created.
Patch pushed, thanks.
Marek
prev parent reply other threads:[~2022-03-30 14:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-29 20:53 Marek Polacek
2022-03-29 20:59 ` Marek Polacek
2022-03-30 2:23 ` Jason Merrill
2022-03-30 2:21 ` Jason Merrill
2022-03-30 14:22 ` Marek Polacek [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=YkRnwTARvIsSojJV@redhat.com \
--to=polacek@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
/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).