This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/29465] New: warning for overlapping memcpy()


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]