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 <[email protected]>:
> 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 <[email protected]>:
>> HI! A test attached is a snippet code from a nimrod compiler. Currenly
>> tcc fails to compile it rigth.
>
a code produced by tcc:
## -2147483648LL
2d: ba 00 00 00 80 mov $0x80000000,%edx
32: 89 45 f4 mov %eax,-0xc(%ebp)
35: b8 ff ff ff ff mov $0xffffffff,%eax
3a: 39 c1 cmp %eax,%ecx
3c: 0f 87 2e 00 00 00 ja 70 <main+0x70> # jg
42: 0f 85 0b 00 00 00 jne 53 <main+0x53> # jl
48: 8b 45 f4 mov -0xc(%ebp),%eax
4b: 39 d0 cmp %edx,%eax
4d: 0f 83 1d 00 00 00 jae 70 <main+0x70>
## -2147483647LL
2d: ba 01 00 00 80 mov $0x80000001,%edx
32: 89 45 f4 mov %eax,-0xc(%ebp)
35: b8 ff ff ff ff mov $0xffffffff,%eax
3a: 39 c1 cmp %eax,%ecx
3c: 0f 8f 2e 00 00 00 jg 70 <main+0x70>
42: 0f 85 0b 00 00 00 jne 53 <main+0x53> # jl
48: 8b 45 f4 mov -0xc(%ebp),%eax
4b: 39 d0 cmp %edx,%eax
4d: 0f 83 1d 00 00 00 jae 70 <main+0x70>
a code produced by gcc:
## -2147483648LL
3a: 83 7d fc ff cmpl $0xffffffff,-0x4(%ebp) # high word
3e: 7f 28 jg 68 <main+0x68>
40: 83 7d fc ff cmpl $0xffffffff,-0x4(%ebp)
44: 7c 09 jl 4f <main+0x4f>
46: 81 7d f8 00 00 00 80 cmpl $0x80000000,-0x8(%ebp) # low word
4d: 73 19 jae 68 <main+0x68>
## -2147483647L
3a: 83 7d fc ff cmpl $0xffffffff,-0x4(%ebp)
3e: 7f 28 jg 68 <main+0x68>
40: 83 7d fc ff cmpl $0xffffffff,-0x4(%ebp)
44: 7c 09 jl 4f <main+0x4f>
46: 81 7d f8 01 00 00 80 cmpl $0x80000001,-0x8(%ebp)
4d: 73 19 jae 68 <main+0x68>
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel