[LLVMbugs] [Bug 11763] New: memcpy call with overlapping (same) regions is created by LLVM

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 13 17:23:49 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=11763

             Bug #: 11763
           Summary: memcpy call with overlapping (same) regions is created
                    by LLVM
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: kcc at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


According to the C/C++ standard, the arguments of memcpy can not overlap. 
But LLVM generates code like 
   memcpy(x, x, size_of_x);

Reproducer: 

% cat memcpy_bug.cc 
struct LargeStruct {
  int foo[100];
};

void copy(LargeStruct *a, LargeStruct *b) {
  *a = *b;
}
% clang++ -O2  memcpy_bug.cc -S && cat memcpy_bug.s | grep call
        callq   memcpy
% g++ -O2  memcpy_bug.cc -S && cat memcpy_bug.s | grep call
% 

(BTW, I remember reporting similar bugs to gcc and they were fixed)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list