Closed xphung closed 5 months ago
I suggest you flag the issue on the mailing list, if not already done. https://lists.sr.ht/~mcf/cproc
Thanks for the bug report! I think this is an issue with qbe's ftoui/dtoui instructions, and I've reported it (along with a patch) here: https://lists.sr.ht/~mpu/qbe/%3C20220128010618.18922-1-bor.groseljsimic%40telemach.net%3E#%3C2WHWJ00ELR8ZM.2DGF0BPWK4MDE@mforney.org%3E
Thanks for the patch :smiley: I will incorporate it into my oasis/cproc build and report back if any problems.
Hi all, qbe master should now have a fix for this issue.
qbe is now updated to latest master in oasis
cproc seems to have a problem with the cast from double to unsigned int (needed by Lua).
I came across the error originally compiling lua v5.2.4 (oasis r0) using cproc (commit #995d5b48b1), but the following c program demonstrates the error more clearly (save source below to a file 'llimit.c', and compile to a.out as shown below):
` DEMO SOURCE CODE:
include
include
define LUA_INT32 int
define LUA_UNSIGNED unsigned LUA_INT32
typedef LUA_UNSIGNED lua_Unsigned;
int main(int arg, char *argv[]) { double u = (1lu<<32) - 0x1234 + arg - arg; //4294962636.0; printf("u = %f, long u = %lx, unsigned u = %x\n", u, (long)u, (lua_Unsigned)u); return 0; }
COMPILE AND EXECUTE:
As you can see above, a.out compiled with gcc gives the correct result, whereas the result is incorrect when compiled with cproc