[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


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

           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 =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
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:


        .text
        ALIGN   16
        .globl  _main
_main:                                                      ; @main
$BB1_0:
        subl    $12, %esp          ;; Why 12 bytes?
$label1:
        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