From: Richard Biener <richard.guenther@gmail.com>
To: Martin Sebor <msebor@gmail.com>
Cc: Gcc Patch List <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] avoid warning for memcpy to self (PR 83456)
Date: Thu, 08 Mar 2018 08:59:00 -0000 [thread overview]
Message-ID: <CAFiYyc2rP1N4J0Nvv06BKBtb+j1LqRerTxQSkUwnC7eoG7kNJg@mail.gmail.com> (raw)
In-Reply-To: <2db2b46a-b716-4a3c-1e42-a066e40d85c7@gmail.com>
On Thu, Mar 8, 2018 at 12:01 AM, Martin Sebor <msebor@gmail.com> wrote:
> I have become convinced that issuing -Wrestrict in gimple-fold
> for calls to memcpy() where the source pointer is the same as
> the destination causes more trouble than it's worth, especially
> when inlining is involved, as in:
>
> inline void bar (void *d, void *s, unsigned N)
> {
> if (s != d)
> memcpy (d, s, N);
> }
>
> void foo (void* src)
> {
> bar (src, src, 1);
> }
>
> It seems that there should be a way to teach GCC to avoid
> folding statements in dead blocks (e.g., in a block controlled
> by 'if (0 != 0)' as the one below), and that it might even speed
> up compilation, but in the meantime it leads to false positive
> -Wrestrict warnings.
>
> The attached patch removes this instance of the warning and
> adjusts tests not to expect it.
Ok.
Richard.
> Martin
next prev parent reply other threads:[~2018-03-08 8:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-07 23:01 Martin Sebor
2018-03-08 8:59 ` Richard Biener [this message]
2018-03-09 0:47 ` Martin Sebor
2018-03-09 19:25 ` Jeff Law
2018-03-17 0:30 ` H.J. Lu
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=CAFiYyc2rP1N4J0Nvv06BKBtb+j1LqRerTxQSkUwnC7eoG7kNJg@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=msebor@gmail.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).