scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 2906c0ed1636c2d72485027f3fa9cb56fe54ba1b
parent 3763a1341f92c675ec2c2fdadf32902eca2466ce
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu,  4 Jul 2013 17:32:14 +0200

Fix bug in listdcl

A declarator generates a derivated type from a base type. So the value
returned by decl_type is a new type. If we don't save the base type
the next variables in the declaration list will have the declarator
type and not the base type.

Diffstat:
Mdecl.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/decl.c b/decl.c @@ -157,15 +157,16 @@ initializer(register struct ctype *tp) } static struct node * -listdcl(struct ctype *tp) +listdcl(struct ctype *base) { struct node *lp = nodecomp(); do { - register struct node *sp, *np; + struct node *sp, *np; + register struct ctype *tp; declarator(); - tp = decl_type(tp); + tp = decl_type(base); if (!tp->type) { warning_error(options.implicit, "type defaults to 'int' in declaration of '%s'",