This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
op.c:S_fold_constants: Add assertion
authorFather Chrysostomos <sprout@cpan.org>
Sun, 16 Jun 2013 06:17:59 +0000 (23:17 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 26 Jul 2013 06:47:59 +0000 (23:47 -0700)
commitba610af835ade3a2ef1a9e1d4ea4e35aa0bc91a7
treef8f61cce905c8bdfb0f6b1828b1174244e34575e
parentce1bce738fd7fbd039c94263073a318218d78cf2
op.c:S_fold_constants: Add assertion

This code correctly handles a value returned by a folded constant that
is a target or a mortal.

If it is neither, then it takes ownership of a reference count (with-
out doing SvREFCNT_inc), so it ends up sharing a reference count with
whatever owned it before.  That is only safe to do with immortals,
which is (afaict) the only other type of scalar that can get through
this code, so it is actually correct.

Changes elsewhere could easily break this, though, so add an
assertion.
op.c