aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorJames Lyon <jamesly0n@hotmail.com>2013-04-19 22:55:09 +0100
committerJames Lyon <jamesly0n@hotmail.com>2013-04-19 22:55:09 +0100
commit23f73e92f3e6c8b16d19d894390af222e77a5ec4 (patch)
tree51d12efc629dbea0ec168ae957132c89737285a1 /tccgen.c
parentcbce6d2bac82351154edb69d6e8f78b4b8dcaa65 (diff)
downloadtinycc-23f73e92f3e6c8b16d19d894390af222e77a5ec4.tar.gz
tinycc-23f73e92f3e6c8b16d19d894390af222e77a5ec4.tar.bz2
Fixed 64-bit integer bug introduced by x86-64 ABI work.
Now I need to check that the x86-64 stuff still works.
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/tccgen.c b/tccgen.c
index 8f2f1bd..71297be 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -790,11 +790,14 @@ ST_FUNC int gv(int rc)
r = get_reg(rc);
#ifdef TCC_TARGET_X86_64
if (((vtop->type.t & VT_BTYPE) == VT_QLONG) || ((vtop->type.t & VT_BTYPE) == VT_QFLOAT)) {
+ int addr_type = VT_LLONG, load_size = 8, load_type = ((vtop->type.t & VT_BTYPE) == VT_QLONG) ? VT_LLONG : VT_DOUBLE;
#else
if ((vtop->type.t & VT_BTYPE) == VT_LLONG) {
+ int addr_type = VT_INT, load_size = 4, load_type = VT_INT;
#endif
- int r2;
+ int r2, original_type;
unsigned long long ll;
+ original_type = vtop->type.t;
/* two register type load : expand to two words
temporarily */
#ifndef TCC_TARGET_X86_64
@@ -809,11 +812,6 @@ ST_FUNC int gv(int rc)
#endif
if (r >= VT_CONST || /* XXX: test to VT_CONST incorrect ? */
(vtop->r & VT_LVAL)) {
-#ifdef TCC_TARGET_X86_64
- int addr_type = VT_LLONG, load_size = 8, load_type = ((vtop->type.t & VT_BTYPE) == VT_QLONG) ? VT_LLONG : VT_DOUBLE;
-#else
- int addr_type = VT_INT, load_size = 4, load_type = VT_INT;
-#endif
/* We do not want to modifier the long long
pointer here, so the safest (and less
efficient) is to save all the other registers
@@ -845,6 +843,7 @@ ST_FUNC int gv(int rc)
vpop();
/* write second register */
vtop->r2 = r2;
+ vtop->type.t = original_type;
} else if ((vtop->r & VT_LVAL) && !is_float(vtop->type.t)) {
int t1, t;
/* lvalue of scalar type : need to use lvalue type