Subject: | Sub::Name may not change its string argument buffer |
The core testsuite comes up with a nice bug in Sub::Name in t/mro/next_edgecases.t
See https://code.google.com/p/perl-compiler/issues/detail?id=345
Sub::Name::subname('Bar::bar', $m);
where
0x00007ffff632ffc2 in XS_Sub__Name_subname (cv=0xab3358) at Name.xs:67
67 *end = 0;
(gdb) p end
$1 = 0x734884 <pv5+6> "bar"
and pv5 is compiled to a static constant buffer.
With perlcc -O3 and probably other embedders you should not change a constant buffer, you need to return a copy instead. The workaround is to create a dynamic variable instead:
my $name = 'Bar::bar';
Sub::Name::subname($name, $m);
I will come up with a simple XS patch.
--
Reini Urban