ref: b2efac468744ce418329438fe413cea578d35d61
parent: 67a9174ff8425d3e4adec10b06664428f4aaf354
author: cinap_lenrek <[email protected]>
date: Sun Jun 26 12:38:46 EDT 2016
5c: handle unused results for cgen64()
--- a/sys/src/cmd/5c/cgen.c
+++ b/sys/src/cmd/5c/cgen.c
@@ -923,6 +923,10 @@
return 0;
case OCAST:
+ if(nn == Z){
+ nullwarn(l, Z);
+ goto Out;
+ }
if(typeilp[n->type->etype] && typev[l->type->etype]){
if(l->op == ONAME || l->op == OINDREG)
nod0 = *l;
@@ -1004,6 +1008,10 @@
goto Out;
case OASHL:
+ if(nn == Z){
+ nullwarn(l, Z);
+ goto Out;
+ }
cgen(l, nn);
assert(r->op == OCONST);
a = r->vconst & 63;
@@ -1033,6 +1041,10 @@
case OLSHR:
case OASHR:
+ if(nn == Z){
+ nullwarn(l, Z);
+ goto Out;
+ }
cgen(l, nn);
assert(r->op == OCONST);
a = r->vconst & 63;
@@ -1062,6 +1074,10 @@
case OAND:
case OXOR:
case OOR:
+ if(nn == Z){
+ nullwarn(l, r);
+ goto Out;
+ }
ml = o == OADD && l->op == OLMUL && machcap(l);
mr = o == OADD && r->op == OLMUL && machcap(r);
if(ml && !mr){
@@ -1133,6 +1149,10 @@
break;
}
+ if(nn == Z){
+ nullwarn(l, r);
+ goto Out;
+ }
if(r->complex > l->complex) {
l = r;
r = n->left;