#40 ``perldl> last'' --> perl stack fandango

critical
closed-fixed
core (120)
7
2003-03-19
2002-06-25
No

I'm using Linux with perl 5.6.1 and PDL v2.3.3cvs2, but I suspect
that this bug works for earlier versions as well.

Typing `last' at the perldl shell kills it.

perldl> last
Can't return outside a subroutine at /usr/bin/perldl line 492
Freeing FFT space
$

It's failing in perldl's "eval_and_report", at the final `return "";'.
Removing the word `return' causes perl to dump core instead
of complaining. Apparently perl's stack has become munged, and
it's convinced that it's running at the top level instead of several
evals and subroutines deep.

The magic in Core.pm is still a little too deep for me to track it beyond
that stage, but I bet there are other similar cases that cause related
crashes too.

Discussion

  • Craig DeForest

    Craig DeForest - 2003-03-19

    Logged In: YES
    user_id=20200

    Seems to be a problem with perl, having to do with the
    interaction between closures and their environment (each
    perldl command is executed as a small closure). Perl seems
    to do a fandango on its stack in this case. The workaround
    is to put an extra
    set of {} braces around the code, within the closure. That
    acts as a trivial once-through loop (see 'man perlsyn' for
    details), catching 'last' and 'next' before they escape the
    closure.

     
  • Craig DeForest

    Craig DeForest - 2003-03-19

    Logged In: YES
    user_id=20200

    Bug fixed in CVS.
    Thanks for reporting the problem!

     
  • Craig DeForest

    Craig DeForest - 2003-03-19
    • assigned_to: nobody --> zowie
    • status: open --> closed-fixed
     

Log in to post a comment.