[Commit] nickle ChangeLog,1.96,1.97 compile.c,1.159,1.160

Keith Packard commit at keithp.com
Mon Nov 15 11:32:46 PST 2004


Committed by: keithp

Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv25619

Modified Files:
	ChangeLog compile.c 
Log Message:
2004-11-15  Keith Packard  <keithp at keithp.com>

	* compile.c: (CompileImplicitInit):
	Implicitly initialize resizable arrays to zero-length array.


Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/nickle/ChangeLog,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- ChangeLog	15 Nov 2004 19:31:40 -0000	1.96
+++ ChangeLog	15 Nov 2004 19:32:43 -0000	1.97
@@ -1,5 +1,10 @@
 2004-11-15  Keith Packard  <keithp at keithp.com>
 
+	* compile.c: (CompileImplicitInit):
+	Implicitly initialize resizable arrays to zero-length array.
+
+2004-11-15  Keith Packard  <keithp at keithp.com>
+
 	* examples/Makefile.am:
 	* examples/apsp.5c:
 	* examples/comb.5c:

Index: compile.c
===================================================================
RCS file: /local/src/CVS/nickle/compile.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- compile.c	1 Oct 2004 19:58:54 -0000	1.159
+++ compile.c	15 Nov 2004 19:32:43 -0000	1.160
@@ -1884,26 +1884,33 @@
     
     switch (type->base.tag) {
     case type_array:
-	if (type->array.dimensions && type->array.dimensions->tree.left)
+	if (type->array.dimensions)
 	{
-	    sub = type->array.type;
-	    init = CompileImplicitInit (sub);
-	    if (init)
+	    if (type->array.resizable)
 	    {
-		dim = CompileCountDeclDimensions (type->array.dimensions);
-		while (--dim >= 0)
+		init = NewExprTree (ANONINIT, 0, 0);
+	    }
+	    else if (type->array.dimensions->tree.left)
+	    {
+		sub = type->array.type;
+		init = CompileImplicitInit (sub);
+		if (init)
 		{
-		    init = NewExprTree (ARRAY,
-					NewExprTree (COMMA,
-						     init,
-						     NewExprTree (COMMA,
-								  NewExprTree (DOTDOTDOT, 0, 0),
-								  0)),
-					0);
+		    dim = CompileCountDeclDimensions (type->array.dimensions);
+		    while (--dim >= 0)
+		    {
+			init = NewExprTree (ARRAY,
+					    NewExprTree (COMMA,
+							 init,
+							 NewExprTree (COMMA,
+								      NewExprTree (DOTDOTDOT, 0, 0),
+								      0)),
+					    0);
+		    }
 		}
+		else
+		    init = NewExprTree (ANONINIT, 0, 0);
 	    }
-	    else
-		init = NewExprTree (ANONINIT, 0, 0);
 	}
 	break;
     case type_hash:




More information about the Commit mailing list