scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 83046300025c0f7afc5a0635480a523410030fa0
parent 17bf67f3529638847c6100f79f2f9d91766a2a6d
Author: Quentin Rameau <quinq@fifth.space>
Date:   Fri,  3 Jun 2016 15:26:20 +0200

[cc2] fix calculation of array sizes

cc1 emits the number of elements of arrays, so we need in cc2 to
multiply that number with the size of the elements type to get the
actual size.

Diffstat:
cc2/parser.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cc2/parser.c b/cc2/parser.c @@ -505,7 +505,7 @@ array(void) size = pop(); base = pop(); tp = pop(); - tp->size = size->u.i; + tp->size = size->u.i * base->size; /* FIXME check for overflow */ tp->align = base->align; delnode(size);