ref: 9c99d0c8d3236b87bd292ac29d4d1b2d5f550bd5
parent: 3e38194d72b2b017b85bf85f11ef4e580d44be4f
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Jan 6 23:40:47 EST 2016
6c: return vlong result for pointer subtraction
--- a/sys/src/cmd/cc/sub.c
+++ b/sys/src/cmd/cc/sub.c
@@ -692,14 +692,6 @@
if(w < 1 || n->left->type->link == T || n->left->type->link->width < 1)
goto bad;
n->type = types[ewidth[TIND] <= ewidth[TLONG]? TLONG: TVLONG];
- if(1 && ewidth[TIND] > ewidth[TLONG]){
- n1 = new1(OXXX, Z, Z);
- *n1 = *n;
- n->op = OCAST;
- n->left = n1;
- n->right = Z;
- n->type = types[TLONG];
- }
if(w > 1) {
n1 = new1(OXXX, Z, Z);
*n1 = *n;
@@ -714,6 +706,14 @@
n->op = OASHR;
n1->vconst = w;
}
+ }
+ if(0 && ewidth[TIND] > ewidth[TLONG]){
+ n1 = new1(OXXX, Z, Z);
+ *n1 = *n;
+ n->op = OCAST;
+ n->left = n1;
+ n->right = Z;
+ n->type = types[TLONG];
}
return;
}