This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/79929] [7 Regression] Bogus Warning: '__builtin_memset': specified size 4294967291 exceeds maximum object size 2147483647
- From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 12 Apr 2017 17:00:43 +0000
- Subject: [Bug fortran/79929] [7 Regression] Bogus Warning: '__builtin_memset': specified size 4294967291 exceeds maximum object size 2147483647
- Auto-submitted: auto-generated
- References: <bug-79929-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79929
--- Comment #4 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Here's equivlalent C code:
$ cat bug.c
#include <stdlib.h>
#include <string.h>
char * foo(char *c, int len)
{
char *p, *n;
n = malloc(len + 5);
p = c + 5;
memmove (c, n, p-c);
if (p < c)
memset (n + 5, 32, c-p);
return n;
}
$ gcc -Wall -O -c bug.c
bug.c: In function 'foo':
bug.c:11:5: warning: 'memset': specified size 18446744073709551611 exceeds
maximum object size 9223372036854775807 [-Wstringop-overflow=]
memset (n + 5, 32, c-p);
I don't think the code is buggy, but the warning is bogus.