summaryrefslogtreecommitdiff
path: root/6/simp.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-01-24 22:45:48 -0800
committerOri Bernstein <ori@eigenstate.org>2016-01-24 22:45:48 -0800
commita0697ff99ca952c46320707b2532bf1459078f56 (patch)
treeae43fe80809fbffb6c92f843ab28a1681d3383f0 /6/simp.c
parent7d2dc676c5bf542cdedee28ec75278bd3b5871af (diff)
downloadmc-a0697ff99ca952c46320707b2532bf1459078f56.tar.gz
A pointer isn't an unsigned int...
Diffstat (limited to '6/simp.c')
-rw-r--r--6/simp.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/6/simp.c b/6/simp.c
index 3705948..a470d95 100644
--- a/6/simp.c
+++ b/6/simp.c
@@ -1256,6 +1256,7 @@ static Node *compare(Simp *s, Node *n, int fields)
[Ole] = {Ole, Oule, Ofle}
};
Node *r;
+ Type *ty;
Op newop;
/* void is always void */
@@ -1263,11 +1264,16 @@ static Node *compare(Simp *s, Node *n, int fields)
return mkboollit(n->loc, 1);
newop = Obad;
- if (istysigned(tybase(exprtype(n->expr.args[0]))))
+ ty = tybase(exprtype(n->expr.args[0]));
+ if (istysigned(ty))
newop = cmpmap[n->expr.op][0];
- else if (istyunsigned(tybase(exprtype(n->expr.args[0]))))
+ else if (istyunsigned(ty))
+ newop = cmpmap[n->expr.op][1];
+ else if (istyunsigned(ty))
+ newop = cmpmap[n->expr.op][1];
+ else if (ty->type == Typtr)
newop = cmpmap[n->expr.op][1];
- else if (istyfloat(tybase(exprtype(n->expr.args[0]))))
+ else if (istyfloat(ty))
newop = cmpmap[n->expr.op][2];
if (newop != Obad) {