http://llvm.org/bugs/show_bug.cgi?id=4203
Summary: Linux/PPC ABI: Obvious way of calling a C function which
takes a struct paramater doesn't work
Product: new-bugs
Version: unspecified
Platform: Other
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P2
Component: new bugs
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Created an attachment (id=2989)
--> (http://llvm.org/bugs/attachment.cgi?id=2989)
a test case
Hi,
Suppose I compile a C function with gcc which takes a single struct parameter,
struct foo { float a, float b };
I would expect to call it from LLVM in the same way, i.e.:
call void @some_function(%struct.foo %examplestruct)
(where %struct.foo = type { float, float }).
This doesn't work (the C function gets nonsense values.) Instead, what does
work is calling it from LLVM by passing a pointer to the struct I want to pass:
call void @some_function(%struct.foo* %pointer_to_examplestruct)
I have attached a simple test case which demonstrates the problem.
The output is:
./fails
x=262253949499549329478747984903838629888.000000, y=0.000000
./works
x=3.140000, y=15.900000
I think, ideally, the 'fails' executable should produce the correct result,
"x=3.140000, y=15.900000".
Thanks
--
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs