scc

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

commit 508ac8d838c64275adceeaad9b24fad8d711e3e3
parent ca4d7fb86e6e291245af6f857c1d83e70b757959
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 19 May 2016 11:10:41 +0200

[cc1] Reduce align type to only 1 byte

It is impossible to have an aligment bigger than 255 bytes

Diffstat:
Mcc1/cc1.h | 2+-
Mcc1/code.c | 2+-
Mcc1/types.c | 4+++-
3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/cc1/cc1.h b/cc1/cc1.h @@ -37,7 +37,7 @@ struct type { char letter; /* letter of the type */ unsigned char prop; /* type properties */ unsigned long size; /* sizeof the type */ - unsigned long align; /* align of the type */ + unsigned char align; /* align of the type */ Type *type; /* base type */ Symbol *tag; /* symbol of the strug tag */ Type *next; /* next element in the hash */ diff --git a/cc1/code.c b/cc1/code.c @@ -263,7 +263,7 @@ emittype(Type *tp) emittype((*sp)->type); emitletter(tp); tag = tp->tag->name; - printf("\t\"%s\t#%c%lX\t#%c%lX\n", + printf("\t\"%s\t#%c%lX\t#%c%X\n", (tag) ? tag : "", sizettype->letter, tp->size, diff --git a/cc1/types.c b/cc1/types.c @@ -171,7 +171,9 @@ typesize(Type *tp) { Symbol **sp; Type *aux; - unsigned long n, size, align, a; + unsigned long size; + int align, a; + TINT n; switch (tp->op) { case ARY: