scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 6ad775491d80225ba2535288259fbd92d42ba103
parent 25bf7c449a349a087ce44203ee69bccded917d14
Author: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
Date:   Fri, 15 Apr 2016 01:04:44 +0200

[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.

Diffstat:
Mcc1/code.c | 3++-
Mcc2/arch/qbe/code.c | 6++++--
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/cc1/code.c b/cc1/code.c @@ -258,7 +258,8 @@ emittype(Type *tp) 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); diff --git a/cc2/arch/qbe/code.c b/cc2/arch/qbe/code.c @@ -201,8 +201,9 @@ writeout(void) 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 @@ inst3(void) { printf("\t%s %c= %s\t%s,%s\n", addr2txt(&pc->to), + 'w', /* FIXME */ optbl[pc->op].txt, addr2txt(&pc->from1), addr2txt(&pc->from2)); }