# New Ticket Created by Nicholas Clark # Please include the string: [perl #72334] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=72334 > By code inspection, there is a bug in S_sortcv_stacked(), as it is not assigning to AvALLOC() if it reallocates @_. I believe that it needs this patch to fix it: diff --git a/pp_sort.c b/pp_sort.c index 12e77f9..0ef567c 100644 --- a/pp_sort.c +++ b/pp_sort.c @@ -1790,6 +1790,7 @@ S_sortcv_stacked(pTHX_ SV *const a, SV *const b) if (AvMAX(av) < 1) { AvMAX(av) = 1; Renew(ary,2,SV*); + AvALLOC(av) = ary; AvARRAY(av) = ary; } } (compare with the analogous code in pp_ctl.c and pp_hot.c: if (items >= AvMAX(av) + 1) { AvMAX(av) = items - 1; Renew(ary,items+1,SV*); AvALLOC(av) = ary; AvARRAY(av) = ary; } ) No tests fail if I made the above change. However, I don't have a test case, and I don't even know if it's possible to create one. The bug seems to have existed since the code was added in 1999, originally in pp_ctl.c: http://perl5.git.perl.org/perl.git/commit/4348140855c01942 Nicholas ClarkThread Next