https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85650

            Bug ID: 85650
           Summary: Additional warnings when -fsanitize=undefined is used
                    with -Wstringop-truncation
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sirl at gcc dot gnu.org
  Target Milestone: ---

Created attachment 44067
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44067&action=edit
testcase 1

These 2 testcases show additional warnings when -fsanitize=undefined is added
to the commandline.

$ LANG=C gcc-8 -c -O2 -fsanitize=undefined -Wstringop-truncation  t8.c 
t8.c: In function 'ay':
t8.c:13:3: warning: 'strncpy' output may be truncated copying between 0 and
7998 bytes from a string of length 7999 [-Wstringop-truncation]
   strncpy(c, a, b);
   ^~~~~~~~~~~~~~~~


$ LANG=C gcc-8 -c -O2 -fsanitize=undefined -Wstringop-truncation t9.c 
t9.c: In function 'd':
t9.c:15:3: warning: 'strncpy' output may be truncated copying between 0 and
4094 bytes from a string of length 4094 [-Wstringop-truncation]
   strncpy(st, a.ah.a, len);
   ^~~~~~~~~~~~~~~~~~~~~~~~

Current trunk@r259927 shows the same behaviour.

Reply via email to