[LLVMbugs] [Bug 2379] New: va_arg broken with x86_fp80

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed May 28 23:38:32 PDT 2008


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

           Summary: va_arg broken with x86_fp80
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sharparrow1 at yahoo.com
                CC: llvmbugs at cs.uiuc.edu


Testcase:

; ModuleID = '-'
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-linux-gnu"

define i32 @a(i32 %i, ...) {
entry:
        %l = alloca i8*
        %l1 = bitcast i8** %l to i8*
        call void @llvm.va_start( i8* %l1 )
        %xxx = va_arg i8** %l, x86_fp80
        %ret = va_arg i8** %l, i32
        call void @llvm.va_end( i8* %l1 )
        ret i32 %ret
}

declare void @llvm.va_start(i8*) nounwind 
declare void @llvm.va_end(i8*) nounwind 

define i32 @main() {
entry:
        %call = call i32 (i32, ...)* @a( i32 1, x86_fp80 1.0, i32 195948557 )
        %cmp = icmp ne i32 %call, 195948557
        br i1 %cmp, label %ifthen, label %ifend

ifthen:         ; preds = %entry
        call void @abort( )
        br label %ifend

ifend:          ; preds = %ifthen, %entry
        ret i32 0
}

declare void @abort()


Run through "llvm-as | lli", should not call abort(), but it does call abort()
on x86 linux.  And if you replace the references to x86_fp80 with references to
double, it does in fact work.

It appears that the implementation of va_arg is ignoring the alignment of
x86_fp80.


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