From: Jason Merrill <jason@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>, Eric Botcazou <botcazou@adacore.com>
Cc: gcc-patches@gcc.gnu.org, Richard Biener <rguenther@suse.de>,
"Joseph S. Myers" <joseph@codesourcery.com>
Subject: Re: [PATCH] tree: Fix up save_expr [PR52339]
Date: Tue, 30 May 2023 16:36:34 -0400 [thread overview]
Message-ID: <93143e27-abd3-bb7d-38e4-0216b81587fa@redhat.com> (raw)
In-Reply-To: <ZHWycyv1gUn1kR/I@tucnak>
On 5/30/23 04:23, Jakub Jelinek wrote:
> On Tue, May 30, 2023 at 10:03:05AM +0200, Eric Botcazou wrote:
>>> We want to be able to treat such things as invariant somehow even if we
>>> can't do that for references to user data that might be changed by
>>> intervening code.
>>>
>>> That is, indicate that we know that the _REF actually refers to a const
>>> variable or is otherwise known to be unchanging.
>>>
>>> Perhaps that should be a new flag that tree_invariant_p can check
>>> instead of TREE_READONLY.
>>
>> Richard earlier suggested a langhook; given that Ada will be the main (sole?)
>> user of it, this would probably be better.
>
> Are the DECL_INVARIANT_P FIELD_DECLs in Ada really invariant no matter how
> exactly they are accessed? Or can Ada suffer from the same problem as
> C/C++, where the FIELD_DECL is TREE_READONLY, but could go out of scope or
> a pointer to it could change.
> I mean the p->fld cases in C/C++, where there could be free (p); or p++
> etc. in between the place where save_expr is first evaluated and later
> uses?
Note that it is fine to treat p->fld as invariant in C++ if fld is
TREE_READONLY and p is itself invariant. The implementation is allowed
to assume that other code didn't destroy *p and create a new object with
a different value of p in the same location under
https://eel.is/c++draft/basic.memobj#basic.life-8.3
Are the Ada references to VLA bounds represented that way?
Jason
next prev parent reply other threads:[~2023-05-30 20:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-05 9:04 Jakub Jelinek
2023-05-05 9:55 ` Jakub Jelinek
2023-05-05 10:45 ` Jakub Jelinek
2023-05-05 11:38 ` Jason Merrill
2023-05-05 13:40 ` Jakub Jelinek
2023-05-05 17:32 ` Jason Merrill
2023-05-05 17:52 ` Jakub Jelinek
2023-05-08 6:23 ` Richard Biener
2023-05-08 15:18 ` Jakub Jelinek
2023-05-09 9:25 ` Eric Botcazou
2023-05-13 10:58 ` Eric Botcazou
2023-05-29 3:14 ` Jason Merrill
2023-05-30 8:03 ` Eric Botcazou
2023-05-30 8:23 ` Jakub Jelinek
2023-05-30 20:36 ` Jason Merrill [this message]
2023-05-30 20:51 ` Jakub Jelinek
2023-05-30 21:08 ` Jason Merrill
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=93143e27-abd3-bb7d-38e4-0216b81587fa@redhat.com \
--to=jason@redhat.com \
--cc=botcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=joseph@codesourcery.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).