This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/83456] -Wrestrict false positive on a non-overlapping memcpy in an inline function
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 06 Feb 2018 18:39:44 +0000
- Subject: [Bug tree-optimization/83456] -Wrestrict false positive on a non-overlapping memcpy in an inline function
- Auto-submitted: auto-generated
- References: <bug-83456-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83456
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-02-06
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=84095
Ever confirmed|0 |1
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Here's a slightly different test case, this one from bug 84095 comment 14
(reduced from bug 84095 comment 17). I'll confirm this bug based on that one.
$ cat t.c && gcc -O2 -S -Wall t.c
extern void* memcpy (void*, const void*, __SIZE_TYPE__);
char a[4];
void f (unsigned n)
{
for (int i = 0; i < 1; i++)
{
if (!i)
continue;
memcpy (a, a, n);
}
}
t.c: In function ‘f’:
t.c:12:7: warning: ‘memcpy’ source argument is the same as destination
[-Wrestrict]
memcpy (a, a, n);
^~~~~~~~~~~~~~~~