[LLVMbugs] [Bug 5046] New: Stack misadjustment when using sret.

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Sep 24 21:00:55 PDT 2009


           Summary: Stack misadjustment when using sret.
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: ofv at wanadoo.es
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=3561)
 --> (http://llvm.org/bugs/attachment.cgi?id=3561)
bitcode file that corresponds to the llvm assembler shown

This code

; ModuleID = 'lp0'
target datalayout =
target triple = "i686-pc-win32"

declare void @abort()

define void @main([28 x i8]* sret) {
  call void @FEACA9C85_FFI_FN([28 x i8]* sret %0, i32 10)
  ret void

declare void @FEACA9C85_FFI_FN([28 x i8]* sret, i32)

produces this:

        ALIGN   16
        .globl  _main
_main:                                                      ; @main
        subl    $12, %esp          ;; Why 12 bytes?
        movl    16(%esp), %eax
        movl    %eax, (%esp)
        movl    $10, 4(%esp)
        call    _FEACA9C85_FFI_FN
        addl    $8, %esp        ;; 8 bytes freed, instead of 12
        ret     $4      ;; This is C callingconv. Why free 4 bytes of args?

The net result is that the return jumps to some trash address.

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