I would like to propose that gcc (in both C and C++ modes) issue a warning
for calls to memcpy() with overlapping regions of memory (known at compile
time) such as the one below since the behavior of such calls is undefined.
#include <string.h>
int main ()
{
int i = 0;
memcpy (&i, &i, sizeof i);
return 0;
}
--
Summary: warning for overlapping memcpy()
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sebor at roguewave dot com
GCC build triplet: all
GCC host triplet: all
GCC target triplet: all
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29465