summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
inline | side by side (from parent 1:
c223721)
This prevents infinite recursion at compile time for ... while 1
constructs, where the body may not contain neither nextstates nor
stubs.
This fixes RT #99458 and RT #99904.
case OP_NEXTSTATE:
case OP_DBSTATE:
case OP_STUB:
case OP_NEXTSTATE:
case OP_DBSTATE:
case OP_STUB:
if (ptable_fetch(seen, o))
return;
ptable_seen_store(seen, o, o);
if (ptable_fetch(seen, o))
return;
ptable_seen_store(seen, o, o);
use lib 't/lib';
use VPIT::TestHelpers;
use lib 't/lib';
use VPIT::TestHelpers;
-plan tests => 11 + 1 * 2 + 5 * 3;
+plan tests => 11 + 5 * 2 + 5 * 3;
{
my $desc = 'peephole optimization of conditionals';
{
my $desc = 'peephole optimization of conditionals';
+ my $base_desc = 'peephole optimization of infinite';
- 'peephole optimization of infinite for loops (RT #64435)' => <<' TESTCASE',
+ "$base_desc for loops (RT #64435)" => <<' TESTCASE',
no autovivification;
my $ret = 0;
for (;;) {
no autovivification;
my $ret = 0;
for (;;) {
+ "$base_desc while loops" => <<' TESTCASE',
+ no autovivification;
+ my $ret = 0;
+ while (1) {
+ ++$ret;
+ exit $ret;
+ }
+ exit $ret;
+ TESTCASE
+ "$base_desc postfix while (RT #99458)" => <<' TESTCASE',
+ no autovivification;
+ my $ret = 0;
+ ++$ret && exit $ret while 1;
+ exit $ret;
+ TESTCASE
+ "$base_desc until loops" => <<' TESTCASE',
+ no autovivification;
+ my $ret = 0;
+ until (0) {
+ ++$ret;
+ exit $ret;
+ }
+ exit $ret;
+ TESTCASE
+ "$base_desc postfix until" => <<' TESTCASE',
+ no autovivification;
+ my $ret = 0;
+ ++$ret && exit $ret until 0;
+ exit $ret;
+ TESTCASE
);
for my $desc (keys %infinite_tests) {
);
for my $desc (keys %infinite_tests) {