Closed GoogleCodeExporter closed 9 years ago
We can't test most of the re test suite without fixing this one.
Original comment by todd.e.rinaldo
on 9 May 2014 at 9:13
same kind of issue when trying to call a sub
> perlcc -r -e 'sub func { 42 } $_ = "x"; /x(?{func "in multiline regexp"})/m'
String found where operator expected at (re_eval 1) line 1, near "func "in
multiline regexp""
(Do you need to predeclare func?)
syntax error at (re_eval 1) line 1, near "func "in multiline regexp""
Compilation failed in regexp.
> perl -e 'sub func { 42 } $_ = "x"; /x(?{func "in multiline regexp"})/m'
Original comment by nicolas....@gmail.com
on 9 May 2014 at 10:25
$>perlcc -O3 -r -e 'my $code = q[{$blah = 45}]; our $blah = 12; eval
"/(?$code)/"; print "$@\n"; print "$blah\n"'
Modification of a read-only value attempted at (re_eval 2) line 1.
12
Original comment by todd.e.rinaldo
on 9 May 2014 at 10:41
So looks like it's modifying the variable in this case that's going wrong, not
the execution in a regex:
$>perlcc -O3 -r -e 'my $code = q[{print "hello"}]; our $blah = 12; eval
"/(?$code)/"; print "$@\n"; '
hello
Original comment by todd.e.rinaldo
on 9 May 2014 at 10:42
Converting the our to my fixes things
$>perlcc -O3 -r -e 'my $code = q[{$blah = 45}]; my $blah = 12; eval
"/(?$code)/"; print "$@\n"; print "$blah\n"'
45
Original comment by todd.e.rinaldo
on 9 May 2014 at 10:47
Original comment by reini.urban
on 9 May 2014 at 11:09
See also issue 135 which errors with:
Eval-group not allowed at runtime, use re 'eval' in regex
Original comment by reini.urban
on 12 May 2014 at 2:05
328 run via -Dtr:
(ccode328.pl:2) entereval
Compiling REx "(?{$blah = 45})"
Final program:
1: EVAL (3)
3: END (0)
minlen 0 with eval
((eval 1):0) nextstate
((eval 1):1) match
Matching REx "(?{$blah = 45})" against ""
0 <> <> | 1:EVAL(3)
((eval 1):1) nextstate
((re_eval 2):1) const(IV(45))
Difference: compiled
((re_eval 2):1) padsv($blah)
((re_eval 2):1) sassign
uncompiled:
((re_eval 2):1) gvsv(main::blah)
((re_eval 2):1) sassign
gvsv finds the blah symbol and assigns to it, padsv not.
Original comment by reini.urban
on 2 Jun 2014 at 9:22
The problem in 5.14 is caused by Perl_sv_compile_2op_is_broken() at
regcomp.c:6819 which miscompiles "$blah = 45" to a padsv instead of gvsv, just
because there also exists a lexical with the same name in the pad.
pp_ctl.c:3072
/* Don't use this. It will go away without warning once the regexp engine is
refactored not to use it. */
Looks like an upstream bug, EWONTFIX'able in the compiler for now.
Original comment by reini.urban
on 3 Jun 2014 at 3:22
Original comment by todd.e.rinaldo
on 3 Jun 2014 at 3:29
Original issue reported on code.google.com by
todd.e.rinaldo
on 9 May 2014 at 9:06