Skip to content

Commit 68000c0

Browse files
committed
Print correct values for testcase 134 on all targets
Testcase 134 only worked on x86_64 and i386 not on other targets.
1 parent eef2db7 commit 68000c0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tccgen.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -3251,8 +3251,12 @@ static void gen_cast(CType *type)
32513251
} else if (sf && dbt == VT_BOOL) {
32523252
vtop->c.i = (vtop->c.ld != 0);
32533253
} else {
3254-
if(sf)
3255-
vtop->c.i = vtop->c.ld;
3254+
if(sf) {
3255+
if (dbt & VT_UNSIGNED)
3256+
vtop->c.i = (uint64_t)vtop->c.ld;
3257+
else
3258+
vtop->c.i = (int64_t)vtop->c.ld;
3259+
}
32563260
else if (sbt_bt == VT_LLONG || (PTR_SIZE == 8 && sbt == VT_PTR))
32573261
;
32583262
else if (sbt & VT_UNSIGNED)

0 commit comments

Comments
 (0)