mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-04 06:30:10 +08:00
riscv64: Fix a corner case
found in mpfr. Expressions like "(longlong)i <= MAX_ULONGLONG" are always true (not yet short-circuited in tcc), but still need to be handled correctly in the backends.
This commit is contained in:
parent
92769362c7
commit
a614269794
@ -999,7 +999,7 @@ static void gen_opil(int op, int ll)
|
||||
++fc;
|
||||
case TOK_LT: func3 = 2; goto do_cop; // slti d, a, fc
|
||||
case TOK_ULE:
|
||||
if (fc >= (1 << 11) - 1)
|
||||
if (fc >= (1 << 11) - 1 || fc == -1)
|
||||
break;
|
||||
++fc;
|
||||
case TOK_ULT: func3 = 3; goto do_cop; // sltiu d, a, fc
|
||||
|
@ -463,6 +463,15 @@ void if2t(void)
|
||||
printf("if2t:ok3\n");
|
||||
}
|
||||
|
||||
void if3t(void)
|
||||
{
|
||||
volatile long long i = 1;
|
||||
if (i <= 18446744073709551615ULL)
|
||||
;
|
||||
else
|
||||
printf ("if3t:wrong 1\n");
|
||||
}
|
||||
|
||||
void if_test(void)
|
||||
{
|
||||
if1t(1, 0, 0, 0);
|
||||
@ -470,6 +479,7 @@ void if_test(void)
|
||||
if1t(3, 2, 0, 0);
|
||||
if1t(4, 2, 3, 0);
|
||||
if2t();
|
||||
if3t();
|
||||
}
|
||||
|
||||
void loop_test()
|
||||
|
Loading…
Reference in New Issue
Block a user