Fix sub-int returns on x86-64 and i386

the ABIs (and other compilers) extend sub-int return values in the
caller.  TCC extends them in the callee.  For compatibility with
those other compilers we have extend them in the caller as well.
That introduces a useless double extension in pure TCC-compiled code,
but fixing that generally requires that the code generator of TCC would
understand sub-int types.  For the time being bite the bullet.
This commit is contained in:
Michael Matz
2019-02-10 18:27:41 +01:00
parent 5f737fb4d3
commit 749d19d70b
2 changed files with 18 additions and 2 deletions

View File

@@ -369,6 +369,7 @@ static void gcall_or_jmp(int is_jmp)
rt = vtop->type.ref->type.t;
switch (rt & VT_BTYPE) {
case VT_BYTE:
case VT_BOOL:
if (rt & VT_UNSIGNED) {
o(0xc0b60f); /* movzx %al, %eax */
}