rurban / perl-compiler

B::C - Moved over from googlecode
https://code.google.com/p/perl-compiler/
Other
64 stars 23 forks source link

Bytecode: read-only error with PMOP in sub #404

Open rurban opened 7 years ago

rurban commented 7 years ago

per email by George tt77ua

1) Simple code (works well if executed by usual perl direcly):

use FCGI;
sub test
{
    my $s=" ";
    $s =~ s/ //g;
    print "test $s \n";
}
test();

2 ) But after: perl -MO=Bytecode,-H,-otest2 test.cgi ; ./test2 I have:

Modification of a read-only value attempted at /usr/local/lib/perl5/site_perl/mach/5.20/FCGI.pm line 2. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/mach/5.20/FCGI.pm line 2. Compilation failed in require at test.cgi line 3. BEGIN failed--compilation aborted at ./test2 line 1360. Modification of a read-only value attempted at ./test2 line 1360.

3) At same time it will work with B::Bytecode if I will remove sub !!! Other good sample below (it work well):

use FCGI;
my $s=" ";
$s =~ s/ //g;
print "test $s \n";

Line 2 inside FCGI.pm is: use strict; What is wrong with simple variables/subroutines when using B::Bytecode ?

rurban commented 7 years ago
cperl5.27.1d-nt -S perlcc -B -e'use strict;
sub test
{
    my $s=" ";
    $s =~ s/ //g;
    print "test $s \n";
}
test();' -o xx.plc && cperl5.27.1d-nt xx.plc
=>
Assertion failed: (isGV_with_GP(_gvflags)), function Perl_gv_check, file gv.c, line 2554