Work around for the issue TCC doesn't handle -2147483648 properly.

TCC produces code which is incompatible with GCC for the following code:

    printf("%lld\n", (long long)-2147483648);
    printf("%lld\n", (long long)-2147483649);

For now, just avoid using the corner value.
This commit is contained in:
Shinichiro Hamaji 2009-04-16 02:41:24 +09:00 committed by grischka
parent 83fd36333a
commit 51a7f163ad

View File

@ -685,7 +685,7 @@ static void relocate_section(TCCState *s1, Section *s)
}
}
long diff = val - addr;
if (diff < -2147483648 || diff > 2147483647) {
if (diff <= -2147483647 || diff > 2147483647) {
/* XXX: naive support for over 32bit jump */
if (s1->output_type == TCC_OUTPUT_MEMORY) {
val = add_jmp_table(s1, val);