https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85420
Bug ID: 85420 Summary: More -Wrestrict false positives with -fsanitize=undefined Product: gcc Version: 8.0.1 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 43950 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43950&action=edit 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); ~~~~~~^~~~~~~~