On Tuesday, July 30, 2002, at 07:20 PM, Simon Glover (via RT) wrote:

>  This code segfaults:
>
>       sweepoff
>       set I0, 0
>
> LOOP: new P0, .PerlString
>       set P0, "ABC"
>       save P0
>       inc I0
>       lt I0, 127, LOOP
>
>       end

This is a fairly straightforward fix.

Parrot_do_dod_run() ordinarily updates pool->num_free_objects as a side 
effect of looking for unused headers. If dod is disabled with sweepoff, 
then num_free_objects doesn't get updated. This confuses a piece of code 
later on which decides that it doesn't need to allocate any new buffers 
after all (although all other evidence point to the contrary).

Parrot segfaults soon after.

I've attached two patches, the first fixes the problem by telling the 
allocator to ignore the value of num_free_objects if it's unknown; the 
second adds the erstwhile crashing code to the test suite (although I'm 
not convinced I've put it in the best place).

Richard.


Attachment: 15845.segfault.patch
Description: Binary data

Attachment: 15845.segfault.test.patch
Description: Binary data


Reply via email to