https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82103
Bug ID: 82103 Summary: spurious stringop-overflow warning Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: arnd at linaro dot org Target Milestone: --- On a current snapshot (tested with r251683), I get a warning that seems unhelpful and probably should not be there. This happened in exactly one file from the Linux kernel so far, on any 32-bit target: $ arm-linux-gnueabi-gcc-8.0.0 -Werror -O2 -march=armv7-a -c -Wall hns_ethtool-b.c hns_ethtool-b.c: In function 'g': hns_ethtool-b.c:9:7: error: 'memset' specified size 4294967295 exceeds maximum object size 2147483647 [-Werror=stringop-overflow=] memset(__p, v, __n); \ ^~~~~~~~~~~~~~~~~~~ hns_ethtool-b.c:18:2: note: in expansion of macro 'memset' memset(&data[frame_size / 2], 0, frame_size / 2 - 1); ^~~~~~ --- extern void f(void); extern void *memset(); #define memset(p, v, n) \ ({ \ void *__p = p; \ unsigned int __n = n; \ if (__n != 0) \ memset(__p, v, __n); \ (__p); \ }) void g(char *data, unsigned int frame_size, _Bool c) { memset(data, 5, frame_size); if (c) f(); memset(&data[frame_size / 2], 0, frame_size / 2 - 1); memset(&data[frame_size / 2 + 0], 4, frame_size / 2 - 11); }