From c2ad11ac70b9ae2010eb63d5eaf77ede0168ca41 Mon Sep 17 00:00:00 2001 From: grischka Date: Sun, 2 Oct 2016 01:38:22 +0200 Subject: tccgen: fix long long -> char/short cast This was causing assembler bugs in a tcc compiled by itself at i386-asm.c:352 when ExprValue.v was changed to uint64_t: if (op->e.v == (int8_t)op->e.v) op->type |= OP_IM8S; A general test case: #include int main(int argc, char **argv) { long long ll = 4000; int i = (char)ll; printf("%d\n", i); return 0; } Output was "4000", now "-96". Also: add "asmtest2" as asmtest with tcc compiled by itself --- tests/asmtest.S | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/asmtest.S') diff --git a/tests/asmtest.S b/tests/asmtest.S index fd0629c..d7d6800 100644 --- a/tests/asmtest.S +++ b/tests/asmtest.S @@ -696,6 +696,7 @@ int $0x10 inc %eax #endif +#ifndef _WIN32 ft1: ft2: ft3: ft4: ft5: ft6: ft7: ft8: ft9: xor %eax, %eax ret @@ -708,6 +709,7 @@ ft1: ft2: ft3: ft4: ft5: ft6: ft7: ft8: ft9: .type ft6,@function .type ft7,%function .type ft8,"function" +#endif pause .rept 6 -- cgit v1.3.1