https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643
Bug ID: 85643
Summary: attribute nonstring fails to squash
-Wstringop-truncation warning
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: amodra at gmail dot com
Target Milestone: ---
Created attachment 44063
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44063&action=edit
testcase
The attached testcase taken from binutils sources fails at -O2 -Wall -Werror
with
strncpy.i: In function ‘f3’:
strncpy.i:24:3: error: ‘__builtin_strncpy’ specified bound 60 equals
destination size [-Werror=stringop-truncation]
__builtin_strncpy (data + 20, name, 60);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
strncpy.i: In function ‘f4’:
strncpy.i:33:3: error: ‘__builtin_strncpy’ specified bound 60 equals
destination size [-Werror=stringop-truncation]
__builtin_strncpy (p, name, 60);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors