[LLVMbugs] [Bug 8778] New: [Win64] incorrect stack frame with alloca(n) and call

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Dec 12 23:45:09 PST 2010


           Summary: [Win64] incorrect stack frame with alloca(n) and call
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: geek4civic at gmail.com
                CC: llvmbugs at cs.uiuc.edu

define i64 @foo(i64 %n) nounwind {
  %buf = alloca i8, i64 %n, align 1
  %r = call i64 @bar(i8* %buf, i64 %n, i64 %n, i64 %n, i64 %n) nounwind
  ret i64 %r
declare i64 @bar(i8* nocapture, i64, i64, i64, i64) nounwind

$ llc -mtriple=x86_64-win32
        pushq   %rbp
        movq    %rsp, %rbp
        subq    $32, %rsp
        movq    %rcx, %rdx
        leaq    15(%rdx), %rax
        andq    $-16, %rax
        movq    %rsp, %rcx
        subq    %rax, %rcx ;;; @bar: 1st arg
        movq    %rcx, %rsp
        subq    $16, %rsp  ;;; 40 (or aligned 48) bytes would be needed
        movq    %rdx, 32(%rsp) ;;; it might be on %buf
        movq    %rdx, %r8
        movq    %rdx, %r9
        callq   bar ;;; 32 bytes home area overlaps to %buf
        movq    %rbp, %rsp
        popq    %rbp

Even when @bar() has args less than 4, stack frame would be incorrect.

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