[svn:parrot] r35859 - trunk/compilers/imcc
[email protected] Wed, 21 Jan 2009 02:58:24 -0800 (PST)
| Newsgroups | perl.cvs.parrot |
|---|---|
| Message-ID | <[email protected]> |
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. */