This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/79929] [7 Regression] Bogus Warning: '__builtin_memset': specified size 4294967291 exceeds maximum object size 2147483647


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]