develooper Front page | perl.perl5.porters | Postings from February 2019

[perl #133660] goto refcount increased by one when using goto

From:
Tony Cook via RT
Date:
February 13, 2019 05:27
Subject:
[perl #133660] goto refcount increased by one when using goto
Message ID:
rt-4.0.24-25395-1550035614-647.133660-15-0@perl.org
On Thu, 07 Feb 2019 06:46:10 -0800, todd.e.rinaldo@gmail.com wrote:
> On Tue, 05 Feb 2019 20:42:46 -0800, tonyc wrote:
> > On Tue, 20 Nov 2018 08:14:16 -0800, todd.e.rinaldo@gmail.com wrote:
> > > The only other action I can see here is to make sure we have a test
> > > for this. I need to look into the tests some more. The tests added in
> > > that commit are a skip and I'm not clear if we'll detect the refcount
> > > issue the next time this happens.
> > > 
> > > I'll try to check them later this week.
> > 
> > Something like the attached?
> > 
> 
> That's it! 
> 
> Fails on maint-5.26 as expected:
> 
> # Failed test 142 - check goto core sub doesn't leak at ./test.pl line 1059
> #      got "not ok"
> # expected "ok"
> # PROG: 
> # 
> #     # done this way to avoid overloads for all of svleak.t
> #     use B;
> #     BEGIN {
> #         *CORE::GLOBAL::open = sub (*;$@) {
> #             goto \&CORE::open;
> #         };
> #     }
> # 
> #     my $refcount;
> #     {
> #         open(my $fh, '<', 'TEST');
> #         my $sv = B::svref_2object($fh);
> #         print $sv->REFCNT == 1 ? "ok" : "not ok";
> #     }
> # STATUS: 0
> 
> And passes on maint-5.28 
> 
> ok 150 - check goto core sub doesn't leak
> 
> I'll let you do the honors. 

Applied as ac6d2595875ea2813009c120fd54eb70c9ed2b0a.

Tony

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



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