http://llvm.org/bugs/show_bug.cgi?id=20847
Bug ID: 20847
Summary: variadic function with AMD64 abi and windows calling
convention
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Created attachment 12986
--> http://llvm.org/bugs/attachment.cgi?id=12986&action=edit
test code
Hi,
Architecture: linux x86-64.
Compilation command line : clang hello.c -o hello
expected output: 1 2 3 4 5 6 7 8 9 10
output: 1 2 3 4 5 6 1 2 3 4 5 6 7 8 9 10
When using __attribute__((ms_abi)) on a variadic function with more than 6
arguments, the program will reiterate at the beginning of the argument passed
on the stack (test code attached).
Firstly, clang pushes all arguments after the first 6 arguments (creates the
register save area) in the stack before the base pointer. Then clang emits the
va_arg and va_list for System V AMD64 and thus instead of going on the stack
and accessing all arguments one-by-one like Microsoft calling convention does,
it goes through the stack until gp_offset is > 48 (e.g until the end of the
register save area, which is located before the base pointer in my program).
Finally, it reiterates starting from the beginning of the register save area.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs