From: Richard Biener <richard.guenther@gmail.com>
To: Roger Sayle <roger@nextmovesoftware.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] PR c/104506: Tolerate error_mark_node in useless_type_conversion_p.
Date: Mon, 14 Feb 2022 16:31:58 +0100 [thread overview]
Message-ID: <CAFiYyc1q3QrCMr3qYNnYMkU1sgmcabFnKzgHkeDUFHLPtpqiTw@mail.gmail.com> (raw)
In-Reply-To: <00c501d821a1$fbcf55b0$f36e0110$@nextmovesoftware.com>
On Mon, Feb 14, 2022 at 1:54 PM Roger Sayle <roger@nextmovesoftware.com> wrote:
>
>
>
> This simple fix to the middle-end, resolves PR c/104506, by adding an
>
> explicit check for error_mark_node to useless_type_conversion_p. I first
>
> trying fixing this in the C front-end, but the type is valid at the point
>
> that the NOP_EXPR is created, so the poisoned type leaks to the middle-end.
Hmm, IMHO "fixing" something to error_mark after it has possibly be used
looks broken.
I don't like trying to paper over this in useless_type_conversion_p, the
predicate should not be called on an error_mark_node type.
Alternatively we might want to create an error_type_node that is at least
a type (with main variant error_type_node and TREE_CODE ERROR_TYPE, etc.).
But likely more complicated than avoiding to mess with the type of 'x' after
the fact?
Richard.
>
> Returning either true or false from useless_type_conversion_p avoids the
>
> ICE-after-error. Apologies to Andrew Pinski, I hadn't noticed that he'd
>
> assigned this PR to himself until after my regression testing had finished.
>
>
>
> This patch has been tested on x86_64-pc-linux-gnu with make bootstrap and
>
> make -k check with no new failures. Ok for mainline?
>
>
>
>
>
> 2022-02-14 Roger Sayle <roger@nextmovesoftware.com>
>
>
>
> gcc/ChangeLog
>
> PR c/104506
>
> * gimple-expr.cc (useless_type_conversion_p): Add a check for
>
> error_mark_node.
>
>
>
> gcc/testsuite/ChangeLog
>
> PR c/104506
>
> * gcc.dg/pr104506.c: New test case.
>
>
>
>
>
> Roger
>
> --
>
>
>
next prev parent reply other threads:[~2022-02-14 15:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-14 12:54 Roger Sayle
2022-02-14 15:31 ` Richard Biener [this message]
2022-02-14 15:34 ` Richard Biener
2022-02-14 23:57 ` Andrew Pinski
2022-02-15 7:32 ` Richard Biener
2022-02-15 7:39 ` Andrew Pinski
2022-02-18 21:41 ` Andrew Pinski
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=CAFiYyc1q3QrCMr3qYNnYMkU1sgmcabFnKzgHkeDUFHLPtpqiTw@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=roger@nextmovesoftware.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).