develooper Front page | perl.perl5.porters | Postings from May 2003

Re: [perl #22194] perldoc -q permute example using faster Algorithm::Permute panic's

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
May 14, 2003 05:34
Subject:
Re: [perl #22194] perldoc -q permute example using faster Algorithm::Permute panic's
Message ID:
20030514123413.GA6473@fdgroup.com
On Wed, May 14, 2003 at 03:46:01AM -0700, David Dyck wrote:
> On Wed, 14 May 2003 at 12:23 +0200, Andreas J. Koenig <andreas.koenig@anima...:
> > panic: invalid pad in pad_sv: 0x816ccb0[0x817a6e8] at test.pl line 51.
> 
> The above panic is why I turned to p5p, but I see that it could
> be just because I have DEBUGGING on and the new macro
>   ASSERT_CURPAD_ACTIVE
> began checking the condition at that time.
> I haven't tried building withoug DEBUGGING turned on yet.

The panic means that something has gone very wrong, either with perl or
the xs, and that at a point where there must be an active pad, there
isn't one. Turning of DEBUGGING just masks the problem.

A quick look at Permute.xs shows that it is directly manipulating
pads, ie

    SAVESPTR(PL_curpad);
    PL_curpad = AvARRAY((AV*)AvARRAY(CvPADLIST(callback))[1]);

which is just plain wrong in bleedperl. In fact the code seems to use
a lot of core features that aren't part of the API, and is therefore
a condidate for breakage on each new release of Perl (it manipulates ops,
it diddles directlty with xav_array, it messes with the context stack
etc).

I haven't looked closely enough at the code to see how it needs to be
fixed.

Dave.


-- 
"There's something wrong with our bloody ships today, Chatfield."
Admiral Beatty at the Battle of Jutland, 31st May 1916.

Thread Previous | Thread Next


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