From: Jason Merrill <jason@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH RFC] c-family: -Wsequence-point and COMPONENT_REF [PR107163]
Date: Tue, 28 Mar 2023 11:31:12 -0400 [thread overview]
Message-ID: <54c69a7a-540d-84e2-f8a3-d2a219c6a208@redhat.com> (raw)
In-Reply-To: <ZB4jaFF2il/x+sLI@tucnak>
On 3/24/23 18:25, Jakub Jelinek wrote:
> On Fri, Mar 24, 2023 at 06:11:44PM -0400, Jason Merrill wrote:
>>> When we touch this for COMPONENT_REF, shouldn't we then handle it as
>>> unary given that the second operand is FIELD_DECL and third/fourth
>>> will likely be NULL and even if not, aren't user expressions that should be
>>> inspected?
>>> So, instead of doing this do:
>>> case COMPONENT_REF:
>>> x = TREE_OPERAND (x, 0);
>>> writer = 0;
>>> goto restart;
>>> ?
>>
>> Is clearing 'writer' what we want, since an access to COMPONENT_REF is an
>> access to (a subobject of) its op0?
>
> I've just mindlessly copied the unary op case.
> writer is set for pre/post increments and lhs of MODIFY_EXPR, and it is
> true that VIEW_CONVERT_EXPR doesn't clear it, but e.g. ARRAY_REF clears it
> for all operands.
For whatever reason leaving writer set led to lots of false positives,
so I've gone with your suggestion.
>> Currently with the fix it takes <1s while gcc12 takes ~80s.
>
> Perfect.
>
>> PR c++/107163
>>
>> gcc/c-family/ChangeLog:
>>
>> * c-common.cc (verify_tree): Don't use sequenced handling
>> for COMPONENT_REF.
>>
>> gcc/testsuite/ChangeLog:
>>
>> * g++.dg/template/recurse5.C: New test.
>
> LGTM, thanks. Maybe the testcase would be better as
> warn/Wsequence-point-5.C, dunno.
Done.
Jason
prev parent reply other threads:[~2023-03-28 15:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-23 20:35 Jason Merrill
2023-03-23 21:03 ` Jakub Jelinek
2023-03-24 22:11 ` Jason Merrill
2023-03-24 22:25 ` Jakub Jelinek
2023-03-28 15:31 ` 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=54c69a7a-540d-84e2-f8a3-d2a219c6a208@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@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).