From: Jeff Law <jeffreyalaw@gmail.com>
To: Richard Biener <rguenther@suse.de>, gcc-patches@gcc.gnu.org
Cc: Jakub Jelinek <jakub@redhat.com>
Subject: Re: [PATCH] tree-optimization/106904 - bogus -Wstringopt-overflow with vectors
Date: Fri, 16 Dec 2022 17:36:31 -0700 [thread overview]
Message-ID: <cae5e9c4-631a-cdbc-1dd6-19bb82c3e74d@gmail.com> (raw)
In-Reply-To: <20221207135418.F35F4136B4@imap1.suse-dmz.suse.de>
On 12/7/22 06:54, Richard Biener via Gcc-patches wrote:
> The following avoids CSE of &ps->wp to &ps->wp.hwnd confusing
> -Wstringopt-overflow by making sure to produce addresses to the
> biggest container from vectorization. For this I introduce
> strip_zero_offset_components which turns &ps->wp.hwnd into
> &(*ps) and use that to base the vector data references on.
> That will also work for addresses with variable components,
> alternatively emitting pointer arithmetic via calling
> get_inner_reference and gimplifying that would be possible
> but likely more intrusive.
>
> This is by no means a complete fix for all of those issues
> (avoiding ADDR_EXPRs in favor of pointer arithmetic might be).
> Other passes will have similar issues.
>
> In theory that might now cause false negatives.
>
> Bootstrap and regtest running on x86_64-unknown-linux-gnu.
>
> Any opinion?
>
> Thanks,
> Richard.
>
> PR tree-optimization/106904
> * tree.h (strip_zero_offset_components): Declare.
> * tree.cc (strip_zero_offset_components): Define.
> * tree-vect-data-refs.cc (vect_create_addr_base_for_vector_ref):
> Strip zero offset components before building the address.
>
> * gcc.dg/Wstringop-overflow-pr106904.c: New testcase.
So you're just canonicalizing to the widest container for a zero offset
access. While it may not fix everything, that seems like a good thing
in general when we can do so. I wouldn't be surprised if other passes
could do the same thing to fix some of the missed CSE opportunities.
jeff
next prev parent reply other threads:[~2022-12-17 0:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-07 13:54 Richard Biener
2022-12-17 0:36 ` Jeff Law [this message]
2022-12-11 13:34 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=cae5e9c4-631a-cdbc-1dd6-19bb82c3e74d@gmail.com \
--to=jeffreyalaw@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.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).