Skip Menu |
Report information
Id: 128253
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: dcollinsn [at] gmail.com
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: low
Type: unknown
Perl Version: (no value)
Fixed In: 5.25.3



Subject: Assert fail in S_find_uninit_var (via Perl_pp_multideref) without other symptoms: $ISA[0][0]
Download (untitled) / with headers
text/plain 15.5k

Message body is not shown because it is too large.

Date: Thu, 7 Jul 2016 16:43:09 +0100
To: perl5-porters [...] perl.org
From: Dave Mitchell <davem [...] iabyn.com>
Subject: Re: [perl #128253] Assert fail in S_find_uninit_var (via Perl_pp_multideref) without other symptoms: $ISA[0][0]
Download (untitled) / with headers
text/plain 2.6k
On Thu, May 26, 2016 at 05:08:31PM -0700, Dan Collins wrote: Show quoted text
> dcollins@nightshade64:~/perldebug$ ./perl -Ilib -W -e '$ISA[0][0]' > Useless use of array element in void context at -e line 1. > perl: sv.c:16093: S_find_uninit_var: Assertion `is_hv' failed. > Aborted
Fixed by the below: commit 6fe82bd6d07db28c9792126ff851a29fe013401c Author: David Mitchell <davem@iabyn.com> AuthorDate: Thu Jul 7 16:24:41 2016 +0100 Commit: David Mitchell <davem@iabyn.com> CommitDate: Thu Jul 7 16:24:41 2016 +0100 handle magic in multideref "unit val" var names [perl #128253] Assert fail in S_find_uninit_var $ perl5240 -we'$ISA[0][0]' Useless use of array element in void context at -e line 1. perl5240: sv.c:16078: S_find_uninit_var: Assertion `is_hv' failed. The code in find_uninit_var() which looks for a variable name associated with an uninitialized value assumed, in the OP_MULTIDEREF branch, that the value was either an index if the op was top-level ($foo[$uninit]), or an array/hash element otherwise (1+$foo[...]). It turns out here's a third possibility: magic. In $ISA[0][0], the first array lookup is in lval context, so it initially autovivifies to undef. Normally it would shortly afterwards be upgraded to a ref to an empty AV, but first ISA set magic for @ISA is invoked. This ends up scanning @ISA and finds an uninit value which it tries to use as a key into the stash cache, triggering an ununit value warning. This commit expands the OP_MULTIDEREF code in find_uninit_var() to handle this third possibility - chiefly by not returning a variable name unless the index var is the same SV as the uninit value. As well as fixing the assert failure in this ticket, it also stops printing an incorrect index in code like this: $ perl -we'my $i = 0; $ISA[$i] = 1' before: .... Use of uninitialized value $i in array element at -e line 1. Use of uninitialized value $i in array element at -e line 1. Recursive inheritance detected in package 'main' at -e line 1. after: .... Use of uninitialized value in array element at -e line 1. Use of uninitialized value in array element at -e line 1. Recursive inheritance detected in package 'main' at -e line 1. @ISA magic still has recursion issues with undef values, as can be seen above. I don't address those issues here. Because of that, I haven't been able to add tests. -- Any [programming] language that doesn't occasionally surprise the novice will pay for it by continually surprising the expert. -- Larry Wall
Download (untitled) / with headers
text/plain 313b
Thank you for filing this report. You have helped make Perl better. With the release today of Perl 5.26.0, this and 210 other issues have been resolved. Perl 5.26.0 may be downloaded via: https://metacpan.org/release/XSAWYERX/perl-5.26.0 If you find that the problem persists, feel free to reopen this ticket.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org