develooper Front page | perl.perl5.porters | Postings from March 2000

Re: [ID 20000330.038] B::Deparse gug isolation

From:
Tom Christiansen
Date:
March 30, 2000 18:05
Subject:
Re: [ID 20000330.038] B::Deparse gug isolation
Message ID:
1054.954468311@chthon
>>% perl -MO=Deparse -cwe 'sub foo { 23 }; foo'
>>% perl -MO=Deparse -cwe 'sub foo { foo($x--) if $x }'

>This patch should fix both of these, plus the bug that B::Deparse went b<SNIP>

If you compile (with perlcc -b) this lovely perl1 code:

    open(TC, "< /etc/termcap");
    while (<TC>) {
	split(/:/, $_);
	for ($i = 0; $i <= $#_; $i++) { 
	    $seen{ $_[$i] }++;
	}
    } 

And then try to uncompile it, this is what happens:

    % perl -MO=Deparse,-p /tmp/tcap.pbc
    open(TC, '< /etc/termcap');
    while (defined(($_ = <TC>))) {
	split(/:/, $_, 0);
	($i = 0);
	while (($i <= $#_)) {
	    (++$seen{$_[$i]});
	}
	continue {
	    (++$i)
	}
    }
    /tmp/tcap.pbc syntax OK
    Attempt to free unreferenced scalar.
    Attempt to free unreferenced scalar.
    Segmentation fault
    [Exit 139]

which looks like something I saw yesterday.

--tom



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About