Update of /cvsroot/monetdb/pathfinder/compiler/mil
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19432/mil

Modified Files:
        milgen.brg 
Log Message:
-- Fixed bug: MIL variable references point into nirvana after realloc.


U milgen.brg
Index: milgen.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/milgen.brg,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -d -r1.128 -r1.129
--- milgen.brg  3 Apr 2008 09:20:42 -0000       1.128
+++ milgen.brg  4 Apr 2008 15:11:06 -0000       1.129
@@ -378,16 +378,17 @@
     assert (varno < 10000);
 
     for (unsigned int i = 0; i < PFarray_last (mvars); i++)
-        if ((var = (mvar_t *) PFarray_at (mvars, i))->pins == 0) {
+        if ((var = *(mvar_t **) PFarray_at (mvars, i))->pins == 0) {
             var->pins = pins;
             return var;
         }
 
     /* If we were not successful, create a new entry */
-    var = (mvar_t *) PFarray_add (mvars);
-
+    var = PFmalloc (sizeof (mvar_t));
     var->name = varno++;
     var->pins = pins;
+    
+    *(mvar_t **) PFarray_add (mvars) = var;
 
     return var;
 }
@@ -8333,7 +8334,7 @@
                     new (type (mty_oid), type (mty_oid))));
 
     /* initialize list of variables we use */
-    mvars = PFarray (sizeof (mvar_t), 100);
+    mvars = PFarray (sizeof (mvar_t *), 100);
 
     /* initialize the variable name counter
        with the first free variable number */
@@ -8352,7 +8353,7 @@
 #ifndef NDEBUG
     mvar_t *var = NULL;
     for (unsigned int i = 0; i < PFarray_last (mvars); i++)
-        if ((var = (mvar_t *) PFarray_at (mvars, i))->pins) {
+        if ((var = *(mvar_t **) PFarray_at (mvars, i))->pins) {
             if (var->pins == 1)
                 PFinfo (OOPS_WARNING,
                         "variable %s stilled pinned once.",
@@ -8380,7 +8381,7 @@
     for (unsigned int i = 0; i < PFarray_last (mvars); i++)
         milprog = seq (milprog,
                        declare (
-                           var (((mvar_t *) PFarray_at (mvars, i))->name)));
+                           var ((*(mvar_t **) PFarray_at (mvars, i))->name)));
 
     milprog = seq (milprog,
                    bodymilprog,


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to