[LLVMbugs] [Bug 11985] New: incorrect code generation for inlined memcpy()

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Feb 11 17:06:22 PST 2012


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

             Bug #: 11985
           Summary: incorrect code generation for inlined memcpy()
           Product: libraries
           Version: 3.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: chuck.caldarale at unisys.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8043
  --> http://llvm.org/bugs/attachment.cgi?id=8043
memcpy() test case

When doing an optimized fixed-length memcpy() using a C source label as the
origin, the code generator fails to take into account that %rip advances as the
code executes.  The result is that the same location is used for each mov into
%[e|r]ax, rather than working through the entire origin area:

0x4005d9 <main()+9>:   mov  -0x34(%rip),%ax   # 0x4005ac <testCase+44>
0x4005e0 <main()+16>:  mov  %ax,-0x2c(%rbp)
0x4005e4 <main()+20>:  mov  -0x3e(%rip),%eax  # 0x4005ac <testCase+44>
0x4005ea <main()+26>:  mov  %eax,-0x30(%rbp)
0x4005ed <main()+29>:  mov  -0x48(%rip),%rax  # 0x4005ac <testCase+44>
0x4005f4 <main()+36>:  mov  %rax,-0x38(%rbp)
0x4005f8 <main()+40>:  mov  %rax,-0x40(%rbp)

The failure occurs when building with clang using -O3.

-- 
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