[Bug c/106927] false-positive -Werror=restrict warnings for memmove (calling memcpy) within array

gcc at boris dot fau.re gcc-bugzilla@gcc.gnu.org
Tue Sep 13 13:39:06 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106927

--- Comment #1 from Boris Faure <gcc at boris dot fau.re> ---
The code is indeed incorrect.

It should be:
#include <string.h>

int main (void)
{
    char s[] = "abcdefghijklmnopqrstuvwxyz012345";
    size_t d = strlen(s);

    __builtin_memmove(s, s + 1, d - 1);

    return 0;
}

However, the error message is not helping.


More information about the Gcc-bugs mailing list