Commit e76c1562 authored by Xavier Leroy's avatar Xavier Leroy
Browse files

x86 32 bits: ABI non-conformance for functions returning structs/unions

The wrong value was returned in EAX, instead of the address of the struct/union.

Report and fix by Zhenguo Yin.

Fixes: #377
parent b40aef6c
......@@ -733,7 +733,7 @@ module Target(System: SYSTEM):TARGET =
| Pret ->
if (not Archi.ptr64)
&& (!current_function_sig).sig_cc.cc_structret then begin
fprintf oc " movl 0(%%esp), %%eax\n";
fprintf oc " movl 4(%%esp), %%eax\n";
fprintf oc " ret $4\n"
end else begin
fprintf oc " ret\n"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment