diff options
Diffstat (limited to 'sys/src/cmd/cc/com.c')
| -rw-r--r-- | sys/src/cmd/cc/com.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/sys/src/cmd/cc/com.c b/sys/src/cmd/cc/com.c index c34b7156f..b8a3b5c44 100644 --- a/sys/src/cmd/cc/com.c +++ b/sys/src/cmd/cc/com.c @@ -178,12 +178,15 @@ tcomo(Node *n, int f) arith(n, 0); while(n->left->op == OCAST) n->left = n->left->left; - if(!sametype(t, n->type) && !mixedasop(t, n->type)) { - r = new1(OCAST, n->right, Z); - r->type = t; - n->right = r; + if(!mixedasop(t, n->type)) { + if(!sametype(t, n->type)) { + r = new1(OCAST, n->right, Z); + r->type = t; + n->right = r; + n->type = t; + } + } else n->type = t; - } break; case OASMUL: @@ -205,11 +208,16 @@ tcomo(Node *n, int f) arith(n, 0); while(n->left->op == OCAST) n->left = n->left->left; - if(!sametype(t, n->type) && !mixedasop(t, n->type)) { - r = new1(OCAST, n->right, Z); - r->type = t; - n->right = r; + if(!mixedasop(t, n->type)) { + if(!sametype(t, n->type)) { + r = new1(OCAST, n->right, Z); + r->type = t; + n->right = r; + n->type = t; + } + } else { n->type = t; + break; } if(typeu[n->type->etype]) { if(n->op == OASDIV) |
