aboutsummaryrefslogtreecommitdiff
path: root/fold.c
diff options
context:
space:
mode:
Diffstat (limited to 'fold.c')
-rw-r--r--fold.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fold.c b/fold.c
index 24b09a6..0bbf8a7 100644
--- a/fold.c
+++ b/fold.c
@@ -334,9 +334,10 @@ foldint(Con *res, int op, int w, Con *cl, Con *cr)
} l, r;
uint64_t x;
uint32_t lab;
- int typ;
+ int typ, rel;
typ = CBits;
+ rel = RelDef;
lab = 0;
l.s = cl->bits.i;
r.s = cr->bits.i;
@@ -345,10 +346,12 @@ foldint(Con *res, int op, int w, Con *cl, Con *cr)
if (cr->type == CAddr)
return 1;
lab = cl->label;
+ rel = cl->rel;
typ = CAddr;
}
else if (cr->type == CAddr) {
lab = cr->label;
+ rel = cr->rel;
typ = CAddr;
}
}
@@ -356,6 +359,7 @@ foldint(Con *res, int op, int w, Con *cl, Con *cr)
if (cl->type == CAddr) {
if (cr->type != CAddr) {
lab = cl->label;
+ rel = cl->rel;
typ = CAddr;
} else if (cl->label != cr->label)
return 1;
@@ -404,6 +408,7 @@ foldint(Con *res, int op, int w, Con *cl, Con *cr)
x = l.u;
if (cl->type == CAddr) {
lab = cl->label;
+ rel = cl->rel;
typ = CAddr;
}
break;
@@ -457,7 +462,7 @@ foldint(Con *res, int op, int w, Con *cl, Con *cr)
else
die("unreachable");
}
- *res = (Con){.type=typ, .label=lab, .bits={.i=x}};
+ *res = (Con){.type=typ, .label=lab, .rel=rel, .bits={.i=x}};
return 0;
}