[svn:parrot] r41157 - in trunk/src: . gc pmc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Tue Sep 8 16:23:33 UTC 2009


Author: NotFound
Date: Tue Sep  8 16:23:31 2009
New Revision: 41157
URL: https://trac.parrot.org/parrot/changeset/41157

Log:
[cage] fix or assert conditions mentioned in Simon Cozen's email about clang static analyzer

Modified:
   trunk/src/gc/mark_sweep.c
   trunk/src/packfile.c
   trunk/src/pmc/string.pmc

Modified: trunk/src/gc/mark_sweep.c
==============================================================================
--- trunk/src/gc/mark_sweep.c	Tue Sep  8 15:14:46 2009	(r41156)
+++ trunk/src/gc/mark_sweep.c	Tue Sep  8 16:23:31 2009	(r41157)
@@ -537,6 +537,7 @@
             return 0;
         }
 
+        PARROT_ASSERT(current);
         arena_base->gc_trace_ptr = current;
 
         /* short-term hack to color objects black */

Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c	Tue Sep  8 15:14:46 2009	(r41156)
+++ trunk/src/packfile.c	Tue Sep  8 16:23:31 2009	(r41157)
@@ -2051,6 +2051,7 @@
     size_t                     i;
     int                        offs;
 
+    PARROT_ASSERT(pf);
     dir->num_segments = PF_fetch_opcode(pf, &cursor);
     TRACE_PRINTF(("directory_unpack: %ld num_segments\n", dir->num_segments));
     mem_realloc_n_typed(dir->segments, dir->num_segments, PackFile_Segment *);

Modified: trunk/src/pmc/string.pmc
==============================================================================
--- trunk/src/pmc/string.pmc	Tue Sep  8 15:14:46 2009	(r41156)
+++ trunk/src/pmc/string.pmc	Tue Sep  8 16:23:31 2009	(r41157)
@@ -992,8 +992,10 @@
         PMC   * const ret    = SUPER();
 
         GET_ATTR_str_val(INTERP, SELF, str_val);
-        /* prevent wrong garbage collection */
-        PObj_is_shared_SET(str_val);
+        if (!STRING_IS_NULL(str_val)) {
+            /* prevent wrong garbage collection */
+            PObj_is_shared_SET(str_val);
+        }
         return ret;
     }
 


More information about the parrot-commits mailing list