[Tinycc-devel] [BUG] tcc and INT64: wrong result of comparison (a test included)

2015-01-04 Thread Sergey Korshunoff
HI! A test attached is a snippet code from a nimrod compiler. Currenly tcc fails to compile it rigth. #include typedef long long int NI64; int main() { NI64 res = 0; printf("Test for comparing a INT64 values: "); if (res < -2147483648LL) { printf("Error: 0 < -2147483648\n"); return

Re: [Tinycc-devel] [BUG] tcc and INT64: wrong result of comparison (a test included)

2015-01-04 Thread Sergey Korshunoff
By replacing a -2147483648 with a -2147483647 I can succesfully build a working nim compiler. But this is not so good... 2015-01-04 12:45 GMT+03:00, Sergey Korshunoff : > HI! A test attached is a snippet code from a nimrod compiler. Currenly > tcc fails to compile it rigth. __

Re: [Tinycc-devel] [BUG] tcc and INT64: wrong result of comparison (a test included)

2015-01-04 Thread Thomas Preud'homme
Le dimanche 4 janvier 2015, 19:18:34 Sergey Korshunoff a écrit : > By replacing a -2147483648 with a -2147483647 I can succesfully build > a working nim compiler. But this is not so good... The bug is in tccpp.c parse_number. The function tries to guess what should be the size and sign of the lit

Re: [Tinycc-devel] [BUG] tcc and INT64: wrong result of comparison (a test included)

2015-01-04 Thread Sergey Korshunoff
It is possible to correct a case for -2147483648 ? A code generated by tcc and gcc is attached. 2015-01-04 19:18 GMT+03:00, Sergey Korshunoff : > By replacing a -2147483648 with a -2147483647 I can succesfully build > a working nim compiler. But this is not so good... > > 2015-01-04 12:45 GMT+03:

Re: [Tinycc-devel] [BUG] tcc and INT64: wrong result of comparison (a test included)

2015-01-04 Thread Sergey Korshunoff
There is another approach: assume the constant is negative by default. This is the method used in nimrod to scan a constants: lib/pure/parseutils.nim(rawparse) proc rawParseInt(s: string, b: var BiggestInt, start: int = 0): int = var sign: BiggestInt = -1 # minus by defaul