From: Jason Merrill <jason@redhat.com>
To: Trevor Saunders <tbsaunde@tbsaunde.org>,
David Malcolm <dmalcolm@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 2/4] allow poisoning input_location in ranges it should not be used
Date: Fri, 2 Jul 2021 11:46:46 -0400 [thread overview]
Message-ID: <e869dcec-49ff-a3fe-02f9-13ba28e737e2@redhat.com> (raw)
In-Reply-To: <YN2V+WiwX5X8r294@rag>
On 7/1/21 6:16 AM, Trevor Saunders wrote:
> On Wed, Jun 30, 2021 at 11:13:23AM -0400, David Malcolm wrote:
>> On Wed, 2021-06-30 at 01:35 -0400, Trevor Saunders wrote:
>>> This makes it possible to assert if input_location is used during the
>>> lifetime
>>> of a scope. This will allow us to find places that currently use it
>>> within a
>>> function and its callees, or prevent adding uses within the lifetime
>>> of a
>>> function after all existing uses are removed.
>>>
>>> bootstrapped and regtested on x86_64-linux-gnu, ok?
>>>
>>> Trev
>>
>> [...snip...]
>>
>>> diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
>>> index d58586f2526..3f68d1d79eb 100644
>>> --- a/gcc/diagnostic.c
>>> +++ b/gcc/diagnostic.c
>>> @@ -1835,7 +1835,7 @@ internal_error (const char *gmsgid, ...)
>>> auto_diagnostic_group d;
>>> va_list ap;
>>> va_start (ap, gmsgid);
>>> - rich_location richloc (line_table, input_location);
>>> + rich_location richloc (line_table, UNKNOWN_LOCATION);
>>> diagnostic_impl (&richloc, NULL, -1, gmsgid, &ap, DK_ICE);
>>> va_end (ap);
>>>
>>
>> I actually make use of this in the analyzer: the analyzer sets
>> input_location to stmt->location when analyzing a given stmt - that
>> way, if the analyzer ICEs, the ICE is shown at the code construct that
>> crashed the analyzer.
>>
>> This behavior is useful to me, and would be lost with the proposed
>> patch.
>
> I made this change because otherwise if the compiler ICE's while access
> to input_location is blocked we end up infinitely recursing complaining
> we can't access it while trying to say where the last error was. I was
> nervous about the change before, and now I agree we need something
> else.
How about allowing a scope (like internal_error) to explicitly un-poison
the variable?
Separately, all the location_t (input_location) changes are pretty
clunky, can we make that conversion part of the macro?
Jason
next prev parent reply other threads:[~2021-07-02 15:46 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-30 5:35 [PATCH 1/4] add utility to poison globals that " Trevor Saunders
2021-06-30 5:35 ` [PATCH 2/4] allow poisoning input_location in ranges it " Trevor Saunders
2021-06-30 9:00 ` Richard Biener
2021-06-30 12:33 ` Trevor Saunders
2021-06-30 19:09 ` Richard Biener
2021-07-01 10:23 ` Trevor Saunders
2021-07-01 12:48 ` Richard Biener
2021-06-30 15:13 ` David Malcolm
2021-06-30 19:34 ` Jason Merrill
2021-07-01 10:16 ` Trevor Saunders
2021-07-01 12:53 ` Richard Biener
2021-07-01 15:40 ` David Malcolm
2021-07-01 16:04 ` David Malcolm
2021-07-01 21:51 ` [committed] input.c: move file caching globals to a new file_cache class David Malcolm
2021-07-11 16:58 ` Lewis Hyatt
2021-07-14 22:53 ` David Malcolm
2021-07-02 0:44 ` [PATCH 2/4] allow poisoning input_location in ranges it should not be used Trevor Saunders
2021-07-02 15:46 ` Jason Merrill [this message]
2021-07-02 23:23 ` Trevor Saunders
2021-07-02 19:20 ` Martin Sebor
2021-07-02 23:47 ` Trevor Saunders
2021-07-06 20:53 ` Martin Sebor
2021-06-30 5:35 ` [PATCH 3/4] allow poisoning cfun Trevor Saunders
2021-06-30 5:35 ` [PATCH 4/4] poison input_location and cfun in one spot Trevor Saunders
2021-06-30 9:02 ` Richard Biener
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=e869dcec-49ff-a3fe-02f9-13ba28e737e2@redhat.com \
--to=jason@redhat.com \
--cc=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=tbsaunde@tbsaunde.org \
/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).