New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x86-64 va_arg instruction is not implemented correctly. #2112
Comments
Verified on darwin/x86-64 |
There is currently no implementation of the x86-64 va_arg operation. llvm-gcc isn't affected because it doesn't currently use LLVM's va_arg |
*** Bug llvm/llvm-bugzilla-archive#2825 has been marked as a duplicate of this bug. *** |
There is a similar problem when using i8 or i16 on x86-32: |
*** Bug llvm/llvm-bugzilla-archive#3569 has been marked as a duplicate of this bug. *** |
Works for me in llvm 3.3 (trunk 170352). |
mentioned in issue llvm/llvm-bugzilla-archive#2825 |
mentioned in issue llvm/llvm-bugzilla-archive#3569 |
mentioned in issue llvm/llvm-bugzilla-archive#6796 |
Extended Description
Using the LLVM 2.1 release, the following test case segfaults when run;
a.ll:
define i32 @test(i32 %X, ...) {
%ap = alloca i8*, i32 1024
%ap2 = bitcast i8** %ap to i8*
call void @llvm.va_start(i8* %ap2)
%tmp = va_arg i8** %ap, i32
call void @llvm.va_end(i8* %ap2)
ret i32 %tmp
}
declare void @llvm.va_start(i8*)
declare void @llvm.va_end(i8*)
define i32 @main(i32, i8**, i8**) {
%ret = call i32(i32, ...)* @test(i32 0, i32 0)
ret i32 %ret
}
result:
$ llvm-as -f a.ll && llc -f a.bc && gcc a.s && ./a.out
Segmentation fault
$
The text was updated successfully, but these errors were encountered: