[not directly related to this specific bug report] On Friday 18 March 2005 00:28, Nick Glencross wrote: > Splicing an intlist seems to segfault. ... > The backtrace is > > #0 0x080d5cf2 in list_splice (interpreter=0x98e8008, list=0x9ae7754, > value=0x9aaa3f0, offset=0, count=0) at src/list.c:1997 With the attached patch, parrot aborts with: parrot: src/list.c:1997: list_splice: Assertion `(value)->pmc_ext' failed. Aborted
It affects only code compiled without -DNDEBUG. Should I apply it? jens
Index: include/parrot/pobj.h =================================================================== RCS file: /cvs/public/parrot/include/parrot/pobj.h,v retrieving revision 1.50 diff -u -w -r1.50 pobj.h --- include/parrot/pobj.h 27 Feb 2005 09:58:43 -0000 1.50 +++ include/parrot/pobj.h 18 Mar 2005 10:40:37 -0000 @@ -187,14 +187,19 @@ typedef struct PMC_EXT PMC_EXT; +#ifdef NDEBUG +# define PMC_ext_checked(pmc) (pmc)->pmc_ext +#else +# define PMC_ext_checked(pmc) (assert((pmc)->pmc_ext), (pmc)->pmc_ext) +#endif /* NDEBUG */ #if PMC_DATA_IN_EXT -# define PMC_data(pmc) (pmc)->pmc_ext->data +# define PMC_data(pmc) PMC_ext_checked(pmc)->data #else # define PMC_data(pmc) (pmc)->data #endif /* PMC_DATA_IN_EXT */ -#define PMC_metadata(pmc) (pmc)->pmc_ext->_metadata -#define PMC_next_for_GC(pmc) (pmc)->pmc_ext->_next_for_GC -#define PMC_sync(pmc) (pmc)->pmc_ext->_synchronize +#define PMC_metadata(pmc) PMC_ext_checked(pmc)->_metadata +#define PMC_next_for_GC(pmc) PMC_ext_checked(pmc)->_next_for_GC +#define PMC_sync(pmc) PMC_ext_checked(pmc)->_synchronize #define PMC_union(pmc) (pmc)->obj.u /* macro for accessing union data */