revert commit b8b6a5fd7b
As it will cause printf("%llu\n", (unsigned long long)1e19); output 9223372036854775808 instead of 10000000000000000000
This commit is contained in:
parent
c6afdff7ab
commit
eef2db71a9
3 changed files with 4 additions and 4 deletions
5
tccgen.c
5
tccgen.c
|
@ -3252,10 +3252,7 @@ error:
|
|||
vtop->c.i = (vtop->c.ld != 0);
|
||||
} else {
|
||||
if(sf)
|
||||
/* the range of [int64_t] is enough to hold the integer part of any float value.
|
||||
Meanwhile, converting negative double to unsigned integer is UB.
|
||||
So first convert to [int64_t] here. */
|
||||
vtop->c.i = (int64_t)vtop->c.ld;
|
||||
vtop->c.i = vtop->c.ld;
|
||||
else if (sbt_bt == VT_LLONG || (PTR_SIZE == 8 && sbt == VT_PTR))
|
||||
;
|
||||
else if (sbt & VT_UNSIGNED)
|
||||
|
|
|
@ -7,4 +7,6 @@ int main() {
|
|||
printf("%d\n", (int)-2147483648.0);
|
||||
d = -2147483648.0;
|
||||
printf("%d\n", (int)d);
|
||||
|
||||
printf("%llu\n", (unsigned long long)1e19);
|
||||
}
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
-1
|
||||
-2147483648
|
||||
-2147483648
|
||||
10000000000000000000
|
||||
|
|
Loading…
Reference in a new issue