a git bisect shows the first bad commit is 4ecee209 (the first release that contains this commit appears to be v5.21.5)
The bisect is misleading; the issue is with split when it is optimised to split directly to an array (rather than just returning a list which later gets assigned to something). When exactly this optimisation is enabled has changed between releases, and that commit is one of those changes.
The real issue was introduced in perl 5.19.4, and I've just fixed in it in blead with this commit:
Author: David Mitchell <firstname.lastname@example.org>
AuthorDate: Wed Nov 30 08:59:01 2016 +0000
Commit: David Mitchell <email@example.com>
CommitDate: Wed Nov 30 09:11:25 2016 +0000
split was leaving PL_sv_undef in unused ary slots
@a = split(/-/,"-");
$a = undef;
$a = 0;
Modification of a read-only value attempted at foo line 3.
This is because:
1) unused slots in AvARRAY between AvFILL and AvMAX should always
null; av_clear(), av_extend() etc do this; while av_store(), if st
to a slot N somewhere between AvFILL and AvMAX, doesn't bother to
between (AvFILL+1)..(N-1) on the assumption that everyone else pla
2) pp_split() when splitting directly to an array, sometimes over-
and has to null out the excess elements;
3) Since perl 5.19.4, unused AV slots are now marked with NULL rat
4) pp_split was still using &PL_sv_undef;
The fault was with (4), and is easily fixed.