Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 31 lines (29 sloc) 0.803 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#! /usr/bin/env perl
# http://code.google.com/p/perl-compiler/issues/detail?id=36
# B::CC fails on some loops
use Test::More tests => 5;
use strict;
BEGIN {
    unshift @INC, 't';
    require "test.pl";
}

# panic: leaveloop, no cxstack at /usr/local/lib/perl/5.10.1/B/CC.pm line 1977
my $script = <<'EOF';
sub f { shift == 2 }
sub test {
while (1) {
last if f(2);
}
while (1) {
last if f(2);
}
}
EOF

use B::CC;
# The problem seems to be non deterministic.
# Some runs of B::CC succeed, some fail and others give a warning.
ccompileok($_, "CC", "ccode36i", $script,
           $B::CC::VERSION < 1.08
? "TODO B::CC issue 36 fixed with B-C-1.28 r556 (B::CC 1.08) by Heinz Knutzen"
: "CC fails sometimes on some loops (fixed with B-C-1.28 r556)")
    for 1..5;
Something went wrong with that request. Please try again.