develooper Front page | perl.perl5.porters | Postings from August 2013

[perl #7028] Can't reset() read-only references

Thread Previous | Thread Next
From:
Brian Fraser via RT
Date:
August 14, 2013 01:43
Subject:
[perl #7028] Can't reset() read-only references
Message ID:
rt-3.6.HEAD-2552-1376444626-1353.7028-15-0@perl.org
On Mon May 21 23:37:53 2001, mjtg@cam.ac.uk wrote:
>   DB<1> *pi = \\3.14
> 
>   DB<2> Dump $pi
> SV = RV(0x122dbc) at 0x234708
>   REFCNT = 1
>   FLAGS = (ROK,READONLY)
>   RV = 0x2346e4
>   SV = NV(0x114480) at 0x2346e4
>     REFCNT = 1
>     FLAGS = (NOK,READONLY,pNOK)
>     NV = 3.14
> 
>   DB<3> reset 'p'
> 
>   DB<4> Dump $pi
> SV = RV(0x122dbc) at 0x234708
>   REFCNT = 1
>   FLAGS = (ROK,READONLY)
>   RV = 0x2346e4
>   SV = NV(0x114480) at 0x2346e4
>     REFCNT = 1
>     FLAGS = (NOK,READONLY,pNOK)
>     NV = 3.14
> 
> 
> I don't understand what the code at sv.c line 5928 (in bleadperl) is
> meant to be doing, but it certainly doesn't look right:
> 
>                 if (SvTHINKFIRST(sv)) {
>                     if (!SvREADONLY(sv) && SvROK(sv))
>                         sv_unref(sv);
>                     continue;
>                 }
> 
> Should the "continue" be conditional on something?
> 
> 
> Mike Guy

This was fixed by Father Chrysostomos (props!) in d6987b29f:

$ ./perl -Ilib -MDevel::Peek -e '*pi = \\3.14; reset "p"; Dump $pi'
SV = IV(0x16a3c38) at 0x16a3c48
  REFCNT = 2
  FLAGS = ()
  IV = 0

--hugmeir


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=7028

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