shithub: scc

Download patch

ref: 2906c0ed1636c2d72485027f3fa9cb56fe54ba1b
parent: 3763a1341f92c675ec2c2fdadf32902eca2466ce
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Jul 4 13:32:14 EDT 2013

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.

--- a/decl.c
+++ b/decl.c
@@ -157,15 +157,16 @@
 }
 
 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'",
--