diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-10-04 20:02:58 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-10-04 20:02:58 +0200 |
commit | bfd0cb0db474a2ace38443537aff86382ec10baf (patch) | |
tree | bd37e71c63992d5ee17a12c3d132393106612985 /sys/src/cmd/cc | |
parent | 9e3ef5c777971707ab4ba426bb55d3bb2553ddf9 (diff) |
cc/6c: fix return type of mixed asop expressions, preserve type for moves so fixed<->float conversions work correctly
Diffstat (limited to 'sys/src/cmd/cc')
-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) |