Commit ed6de5af authored by Russ Cox's avatar Russ Cox

comparisons have type bool

R=ken
OCL=34995
CL=34997
parent 78ebe2b3
...@@ -337,8 +337,8 @@ reswitch: ...@@ -337,8 +337,8 @@ reswitch:
goto badbinary; goto badbinary;
t = l->type; t = l->type;
if(iscmp[n->op]) { if(iscmp[n->op]) {
t = idealbool;
evconst(n); evconst(n);
t = types[TBOOL];
if(n->op != OLITERAL) { if(n->op != OLITERAL) {
defaultlit2(&l, &r, 1); defaultlit2(&l, &r, 1);
n->left = l; n->left = l;
...@@ -567,7 +567,7 @@ reswitch: ...@@ -567,7 +567,7 @@ reswitch:
n->type = T; n->type = T;
if(top & Erv) { if(top & Erv) {
n->op = OSENDNB; n->op = OSENDNB;
n->type = idealbool; n->type = types[TBOOL];
} }
goto ret; goto ret;
...@@ -745,7 +745,7 @@ reswitch: ...@@ -745,7 +745,7 @@ reswitch:
goto error; goto error;
} }
if(n->op == OCLOSED) { if(n->op == OCLOSED) {
n->type = idealbool; n->type = types[TBOOL];
ok |= Erv; ok |= Erv;
} else } else
ok |= Etop; ok |= Etop;
...@@ -1196,7 +1196,7 @@ checkconv(Type *nt, Type *t, int explicit, int *op, int *et) ...@@ -1196,7 +1196,7 @@ checkconv(Type *nt, Type *t, int explicit, int *op, int *et)
*op = OCONV; *op = OCONV;
*et = 0; *et = 0;
// preexisting error // preexisting error
if(t == T || t->etype == TFORW) if(t == T || t->etype == TFORW)
...@@ -1921,7 +1921,7 @@ typecheckas2(Node *n) ...@@ -1921,7 +1921,7 @@ typecheckas2(Node *n)
n->op = OAS2MAPW; n->op = OAS2MAPW;
n->rlist->n = typecheckconv(nil, r, l->type->down, 0); n->rlist->n = typecheckconv(nil, r, l->type->down, 0);
r = n->rlist->next->n; r = n->rlist->next->n;
n->rlist->next->n = typecheckconv(nil, r, types[TBOOL], 1); n->rlist->next->n = typecheckconv(nil, r, types[TBOOL], 0);
goto out; goto out;
} }
...@@ -1971,7 +1971,7 @@ typecheckas2(Node *n) ...@@ -1971,7 +1971,7 @@ typecheckas2(Node *n)
if(l->defn == n) if(l->defn == n)
l->type = r->type; l->type = r->type;
l = n->list->next->n; l = n->list->next->n;
if(l->type != T && checkconv(idealbool, l->type, 0, &op, &et) < 0) if(l->type != T && checkconv(types[TBOOL], l->type, 0, &op, &et) < 0)
yyerror("cannot assign bool value to %+N", l); yyerror("cannot assign bool value to %+N", l);
if(l->defn == n && l->ntype == N) if(l->defn == n && l->ntype == N)
l->type = types[TBOOL]; l->type = types[TBOOL];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment