tccgen: fix long long -> char/short cast
commitc2ad11ac70b9ae2010eb63d5eaf77ede0168ca41
authorgrischka <grischka>
Sat, 1 Oct 2016 23:38:22 +0000 (2 01:38 +0200)
committergrischka <grischka>
Sat, 1 Oct 2016 23:39:14 +0000 (2 01:39 +0200)
treec81d6cfa09bfcf1d9f0b433bb5e5846582cce702
parentf350487e1e5d4606c8b1508f920b7325c3c50bc1
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 <stdio.h>
    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
tccgen.c
tests/Makefile
tests/asmtest.S