aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2016-10-09 00:44:22 +0200
committerMichael Matz <matz@suse.de>2016-12-15 17:49:55 +0100
commit235711f3d3a5a41a4bb51a22dca6700aa77d34c1 (patch)
tree19a5969c24864534990e90f6f37b58addedb7933 /tccgen.c
parenta2a596e76724a7915361b4d0f1b5553929d26a31 (diff)
downloadtinycc-235711f3d3a5a41a4bb51a22dca6700aa77d34c1.tar.gz
tinycc-235711f3d3a5a41a4bb51a22dca6700aa77d34c1.tar.bz2
64bit: Fix addends > 32 bits
If a symbolic reference is offsetted by a constant > 32bit the backends can't deal with that, so don't construct such values.
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tccgen.c b/tccgen.c
index 5c74971..b490c04 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -1775,8 +1775,13 @@ static void gen_opic(int op)
/* symbol + constant case */
if (op == '-')
l2 = -l2;
+ l2 += vtop[-1].c.i;
+ /* The backends can't always deal with addends to symbols
+ larger than +-1<<31. Don't construct such. */
+ if ((int)l2 != l2)
+ goto general_case;
vtop--;
- vtop->c.i += l2;
+ vtop->c.i = l2;
} else {
general_case:
if (!nocode_wanted) {