CC: | ZEFRAM [...] cpan.org |
During hack on RT#123868: $a/$b/$_ refcounting bugs and referred RT#96343: first return value error I added some test code to List::MoreUtils::XS proving for leaks when 'undef *_':
no_leaks_ok(
sub { eval {my $ok = all { undef *_; 1 } (0 .. 2);} }, ... );
This causes SEGFAULT: 11
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 perl 0x000000010f8c7880 S_sv_unmagicext_flags + 336
1 perl 0x000000010f8c871f Perl_sv_clear + 239
2 perl 0x000000010f8c95ce Perl_sv_free2 + 94
3 perl 0x000000010f8b9d7f Perl_pp_iter + 1199
4 LeakTrace.bundle 0x000000010fb706be leaktrace_runops + 270
I tried to assign a new SV to *_ - but this assignment caused Test::LeakTrace to report a false positive.
If I understood Zefram correctly, $_ has it's only refcounting and when $_ holds a reference to an object or a new SV after tested sub, it is ok.