Bug ID: 85420
           Summary: More -Wrestrict false positives with
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot
          Reporter: sirl at gcc dot
  Target Milestone: ---

Created attachment 43950
C testcase

The attached testcases produce extra warnings of the "may overlap" kind with
-Wrestrict -fsanitize=undefined (PR85365 covers the "same destination" kind).

# gcc-8 -c -O2 -fsanitize=undefined -Wrestrict t5.c 
t5.c: In function 'c':
t5.c:6:5: warning: 'strcpy' accessing 1 byte at offsets 0 and [0, 1] may
overlap 1 byte at offset 0 [-Wrestrict]
     strcpy(b, b + a);

g++-8 -c -O2 -fsanitize=undefined -Wrestrict t6.cpp 
t6.cpp: In member function 'int c::m_fn1()':
t6.cpp:13:9: warning: 'char* strcat(char*, const char*)' accessing 4096 or more
bytes at offsets 0 and 4095 may overlap 1 byte at offset 4095 [-Wrestrict]
   strcat(e, d.b);

Reply via email to