https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86345
Bug ID: 86345 Summary: Likely false warning with -Wstringop-overflow and memset Product: gcc Version: 9.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: sirl at gcc dot gnu.org Target Milestone: --- Created attachment 44335 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44335&action=edit testcase The attached testcase warns like this with trunk@262215: gcc-trunk -c -O2 -Wstringop-overflow test-stringop-overflow.c test-stringop-overflow.c: In function 'func2': test-stringop-overflow.c:56:3: warning: 'memset' specified size between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=] memset ((buf), 0, (len)); ^~~~~~~~~~~~~~~~~~~~~~~~ This is a relatively new regression on trunk (gcc-8-branch is fine). The code is quite sensitive to changes, so I didn't reduce it further.