https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112833
--- Comment #1 from Alejandro Colomar <alx at kernel dot org> ---
Oops, in the reproducer from above, I should only expect a warning at call
site. The definition is correct, since all parameters are restrict, so it's
free to copy one to the other.
Here's a reproducer where the call is fine, but the definition is wrong, and
the compiler doesn't realize:
$ cat restrict.c
#include <string.h>
long bogus2_strtol(const char *s, char **restrict ep, int base);
int
main(void)
{
char buf[3] = "foo";
char *p = buf;
bogus2_strtol(p, &p, -42);
}
long
bogus2_strtol(const char *s, char **restrict ep, int base)
{
memcpy(*ep, s, 1);
return base;
}
$ gcc -Wall -Wextra restrict.c -fanalyzer
$ gcc -Wall -Wextra restrict.c -fanalyzer -O3