[LLVMbugs] [Bug 22060] New: MC generated wrong code for label arithmetic

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Dec 30 00:27:39 PST 2014


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

            Bug ID: 22060
           Summary: MC  generated wrong code for label arithmetic
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: MC
          Assignee: unassignedbugs at nondot.org
          Reporter: humeafo at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13606
  --> http://llvm.org/bugs/attachment.cgi?id=13606&action=edit
the sample

see aa.s in attachment, then

llvm-mc -arch=x86 -triple=pc-windows-msvc -filetype=obj aa.s -o aa.obj

we disassemble the aa.obj and can found following 

    calll    L18$pb
L18$pb:
    popl    %eax
    leal    "?WndProc@@YGJPAUHWND__@@IIJ at Z"-L18$pb(%eax), %eax
    movl    24(%ebp), %ecx
    movl    20(%ebp), %edx
    movl    16(%ebp), %esi
    movl    12(%ebp), %edi
    movl    8(%ebp), %ebx
    movl    %eax, 76(%esp)          # 4-byte Spill
  retl

    .def     "?WndProc@@YGJPAUHWND__@@IIJ at Z";
    .scl    2;
    .type    32;
    .endef
    .globl    "?WndProc@@YGJPAUHWND__@@IIJ at Z"
"?WndProc@@YGJPAUHWND__@@IIJ at Z":        # @"\01?WndProc@@YGJPAUHWND__@@IIJ at Z"
# BB#0:
    pushl    %ebp
    movl    %esp, %ebp
  retl

is assembled to 

.text:00000000                 public
?SetUpWindow@@YAPAUHWND__@@PBD0HHPAUHINSTANCE__@@@Z
.text:00000000 ?SetUpWindow@@YAPAUHWND__@@PBD0HHPAUHINSTANCE__@@@Z proc near
.text:00000000
.text:00000000 arg_0           = dword ptr  8
.text:00000000 arg_4           = dword ptr  0Ch
.text:00000000 arg_8           = dword ptr  10h
.text:00000000 arg_C           = dword ptr  14h
.text:00000000 arg_10          = dword ptr  18h
.text:00000000
.text:00000000                 push    ebp
.text:00000001                 mov     ebp, esp
.text:00000003
.text:00000003 loc_3:
.text:00000003                 push    ebx
.text:00000004                 push    edi
.text:00000005                 push    esi
.text:00000006                 and     esp, 0FFFFFFF8h
.text:00000009                 sub     esp, 80h
.text:0000000F                 call    $+5
.text:00000014                 pop     eax
.text:00000015
.text:00000015 loc_15:
.text:00000015                 lea     eax, [eax+3]
.text:0000001B                 mov     ecx, [ebp+arg_10]
.text:0000001E                 mov     edx, [ebp+arg_C]
.text:00000021                 mov     esi, [ebp+arg_8]
.text:00000024                 mov     edi, [ebp+arg_4]
.text:00000027                 mov     ebx, [ebp+arg_0]
.text:0000002A                 mov     [esp+4Ch], eax
.text:0000002E                 retn
.text:0000002E ?SetUpWindow@@YAPAUHWND__@@PBD0HHPAUHINSTANCE__@@@Z endp ;
sp-analysis failed


.text:00000015                 lea     eax, [eax+3] 

obviuosly it is not the right code for:

leal    "?WndProc@@YGJPAUHWND__@@IIJ at Z"-L18$pb(%eax), %eax

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141230/534c774c/attachment.html>


More information about the llvm-bugs mailing list