shithub: scc

Download patch

ref: 08101d44e9bbe55186d76aa2087c9267fc2c4fb3
parent: 7f8b4f86e59164d4b18f3a4285ca6d801522c77c
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Apr 14 21:04:44 EDT 2016

[cc1 - cc2] Fix several errors in printf formats

We have to be careful that target dependant sizes must be printed
always with lld, because iin this way we can be sure it will be correct
always.

--- a/cc1/code.c
+++ b/cc1/code.c
@@ -258,7 +258,8 @@
 		emitletter(tp);
 		putchar('\t');
 		emitletter(tp->type);
-		printf("\t#%c%d\n", sizettype->letter, tp->n.elem);
+		printf("\t#%c%lld\n",
+		       sizettype->letter, (long long) tp->n.elem);
 		return;
 	case PTR:
 		emittype(tp->type);
--- a/cc2/arch/qbe/code.c
+++ b/cc2/arch/qbe/code.c
@@ -201,8 +201,9 @@
 
 	for ( ; p; p = p->next) {
 		tp = &p->type;
-		printf("\t%s %s= alloc%d %d\n",
-		       symname(p), size2asm(tp), tp->size, tp->align);
+		printf("\t%s %s= alloc%lld %lld\n",
+		       symname(p), size2asm(tp),
+		       (long long) tp->size, (long long) tp->align);
 	}
 
 	for (pc = prog; pc; pc = pc->next) {
@@ -233,6 +234,7 @@
 {
 	printf("\t%s %c= %s\t%s,%s\n",
 	       addr2txt(&pc->to),
+	       'w',                    /* FIXME */
 	       optbl[pc->op].txt,
 	       addr2txt(&pc->from1), addr2txt(&pc->from2));
 }