https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109995
Bug ID: 109995 Summary: Bogus warning about __builtin_memset, from -Wstringop-overflow Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: bruno at clisp dot org Target Milestone: --- Created attachment 55171 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55171&action=edit test case bar.c In the attached program, -Wall produces a warning "warning: ‘__builtin_memset’ specified bound 18446744073709551614 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]", in a function that does not invoke 'memset' nor '__builtin_memset'. With gcc 10.4.0: $ gcc -O2 -Wall -S bar.c In function ‘memset_small’, inlined from ‘wrap’ at bar.c:242:1: bar.c:249:17: warning: ‘__builtin_memset’ specified bound 18446744073709551614 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=] 249 | do *++p = c; while (--n > 0); | ~~~~~^~~ With gcc 11.3.0, 12.3.0, 13.1.0: $ gcc -O2 -Wall -S bar.c In function ‘memset_small’, inlined from ‘memset_small’ at bar.c:242:1, inlined from ‘wrap’ at bar.c:590:19: bar.c:249:17: warning: ‘__builtin_memset’ specified bound 18446744073709551614 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=] 249 | do *++p = c; while (--n > 0); | ~~~~~^~~