develooper Front page | perl.perl5.porters | Postings from April 2016

Re: [perl #127952] Perl_ck_refassign: Assertion `left->op_type ==OP_SREFGEN' failed (op.c:10498)

Thread Previous
From:
Zefram
Date:
April 21, 2016 23:03
Subject:
Re: [perl #127952] Perl_ck_refassign: Assertion `left->op_type ==OP_SREFGEN' failed (op.c:10498)
Message ID:
20160421230318.GF8328@fysh.org
Brian Carpenter wrote:
>perl -e '0,!n||!\r=0' triggers an assertion failure

The initial "0," is not required, but all of the rest is.  The assertion
is that the lhs of the assignment is an srefgen op, and it's found to
actually be an ex-not op whose child is an srefgen op.  Something goes
awry in optimising that lhs: that not op can't be validly optimised out.
The same bug can be seen when using the same expression in rvalue context:

$ perl -le '$a = !n||!\r; print $a || "false"'
SCALAR(0xc8eb08)

This clearly should have printed "false".  Nearby expressions behave
as expected:

$ perl -le '$a = !"n"||!\r; print $a || "false"'
false
$ perl -le '$a = !n||!\"r"; print $a || "false"'
false
$ perl -le '$a = !!!n||!\r; print $a || "false"'
false
$ perl -le '$a = !n||\r; print $a || "false"'
SCALAR(0x246fb08)
$ perl -le '$a = n||!\r; print $a || "false"'
n
$ perl -le '$a = n||\r; print $a || "false"'
n

-zefram

Thread Previous


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