Nicholas Clark <[EMAIL PROTECTED]> writes:
>On Mon, Feb 27, 2006 at 09:17:57PM +0000, Nicholas Clark wrote:
>> On Mon, Feb 27, 2006 at 07:02:53PM +0100, Rafael Garcia-Suarez wrote:
>> > On 2/27/06, John E. Malmberg <[EMAIL PROTECTED]> wrote:
>> > > It looks like Perl is now detecting the error a little better.
>> > >
>> > > The results of blead 27323 on OpenVMS Alpha 8.2 are:
>> > >
>> > > EAGLE> mcr []ndbgperl -e '*a=$a=*b; $a=42'
>> > > Assertion ((sstr)->sv_flags & 0xff) == SVt_PVGV || ((sstr)->sv_flags &
>> > > 0xff) == SVt_PVLV failed: file "PERL_BUILD_ROOT:[000000]sv.c;1", line
>> > > 3214 at -e line 1.
>> > > %SYSTEM-F-ABORT, abort
>> > 
>> > It does so because you use a perl compiled with -DDEBUGGING, I think
>> > it still segfaults without that. But now we know were the segfault
>> > happens :)
>> 
>> And the immediate why:
>> 
>> (gdb) call Perl_sv_dump(my_perl, sstr)
>> SV = UNKNOWN(0xff) (0x82781dc) at 0x8278f5c
>>   REFCNT = 0
>>   FLAGS = ()
>
>$ ./perl -Dt -we '*a = $a = *b'
>Name "main::b" used only once: possible typo at -e line 1.
>
>EXECUTING...
>
>(-e:0)  enter
>(-e:0)  nextstate
>(-e:1)  gv(main::b)
>(-e:1)  rv2gv
>(-e:1)  gvsv(main::a)
>(-e:1)  sassign
>(-e:1)  gv(main::a)
>(-e:1)  rv2gv
>(-e:1)  sassign
>Assertion ((shplep)->sv_flags & 0xff) == SVt_PVGV || ((shplep)->sv_flags & 
>0xff) == SVt_PVLV failed: file "sv.c", line 3234 at -e line 1.
>
>
>I don't see a "good" solution to this. Short of changing
>
>PP(pp_gvsv)
>{   
>    dVAR;
>    dSP;
>    EXTEND(SP,1);
>    if (PL_op->op_private & OPpLVAL_INTRO)
>        PUSHs(save_scalar(cGVOP_gv));
>    else
>        PUSHs(GvSVn(cGVOP_gv));
>    RETURN;
>}
>
>so that we increment the reference count of GvSVn and arrange for that
>reference count to drop later. 

What is "later" here? - would scope exit do i.e. can we jut increment 
refcnt and push it to the "temps" stack?

>(With similar code for arrays and hashes:
>
>$ ./perl -e '*a=$a[0]=*b'
>Assertion ((shplep)->sv_flags & 0xff) == SVt_PVGV || ((shplep)->sv_flags & 
>0xff) == SVt_PVLV failed: file "sv.c", line 3234 at -e line 1.
>$ ./perl -e '*a=$a{x}=*b'
>Assertion ((shplep)->sv_flags & 0xff) == SVt_PVGV || ((shplep)->sv_flags & 
>0xff) == SVt_PVLV failed: file "sv.c", line 3234 at -e line 1.
>
>) Or short of removing all the mortal hackery and making the perl stack
>properly reference counted.
>
>Unless there's an easy way for the optimiser to spot this problem and
>arrange to avoid it in some fashion (maybe by building a different optree)
>
>Nicholas Clark


Reply via email to