develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35859 - trunk/compilers/imcc

From:
jonathan
Date:
January 21, 2009 02:58
Subject:
[svn:parrot] r35859 - trunk/compilers/imcc
Message ID:
20090121105824.46602CB9AE@x12.develooper.com
Author: jonathan
Date: Wed Jan 21 02:58:21 2009
New Revision: 35859

Modified:
   trunk/compilers/imcc/pbc.c

Log:
[imcc] Fix segfault that happened when using annotations in eval'd PIR.

Modified: trunk/compilers/imcc/pbc.c
==============================================================================
--- trunk/compilers/imcc/pbc.c	(original)
+++ trunk/compilers/imcc/pbc.c	Wed Jan 21 02:58:21 2009
@@ -2169,12 +2169,15 @@
         /* Add annotations seg if we're missing one. */
         if (!interp->code->annotations) {
             /* Create segment. */
-            char * const name = (char *) mem_sys_allocate(strlen(interp->code->base.name) + 5);
+            char               * const name = (char *) mem_sys_allocate(strlen(interp->code->base.name) + 5);
+            int                        add  = interp->code && interp->code->base.dir;
+            PackFile_Directory * const dir  = add ? interp->code->base.dir :
+                    &interp->initial_pf->directory;
             strcpy(name, interp->code->base.name);
             strcat(name, "_ANN");
             interp->code->annotations = (PackFile_Annotations *)
-                    PackFile_Segment_new_seg(interp, interp->code->base.dir,
-                        PF_ANNOTATIONS_SEG, name, 1);
+                    PackFile_Segment_new_seg(interp, dir,
+                        PF_ANNOTATIONS_SEG, name, add);
             interp->code->annotations->code = interp->code;
 
             /* Create initial group. */



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About