git: 9front

Download patch

ref: 22af5f26ba10370b75cf2a7b1efd73256a8c036f
parent: fa7da71a4c5e45ff764d801dde877b4b188117a6
author: Jacob Moody <moody@posixcafe.org>
date: Mon Apr 29 17:31:05 EDT 2024

9c: copy warning from other compilers regarding pointer -> int truncation

--- a/sys/src/cmd/9c/cgen.c
+++ b/sys/src/cmd/9c/cgen.c
@@ -476,6 +476,10 @@
 			cgen(l, nn);
 			break;
 		}
+		if(ewidth[n->type->etype] < ewidth[l->type->etype]){
+			if(l->type->etype == TIND && typechlp[n->type->etype])
+				warn(n, "conversion of pointer to shorter integer");
+		}
 		regalloc(&nod, l, nn);
 		cgen(l, &nod);
 		regalloc(&nod1, n, &nod);
--