Skip to content

Commit

Permalink
PATCH: Segfault on misspelled :outer
Browse files Browse the repository at this point in the history
Courtesy of Bog Rogers <rogers-perl6@rgrjr.dyndns.org>

---
Workaround freeze/thaw depth first breakage, which kills
proper thawing of hashes, if these are contained in
outer data structures and aren't last in visit order.



git-svn-id: https://svn.parrot.org/parrot/trunk@10320 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
Leopold Toetsch committed Dec 3, 2005
1 parent 3bf3026 commit d3c1507
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions classes/sub.pmc
Expand Up @@ -439,10 +439,10 @@ Archives the subroutine.
(info->visit_pmc_now)(INTERP, sub->namespace, info);
info->thaw_ptr = &sub->multi_signature;
(info->visit_pmc_now)(INTERP, sub->multi_signature, info);
info->thaw_ptr = &sub->lex_info;
(info->visit_pmc_now)(INTERP, sub->lex_info, info);
info->thaw_ptr = &sub->outer_sub;
(info->visit_pmc_now)(INTERP, sub->outer_sub, info);
info->thaw_ptr = &sub->lex_info;
(info->visit_pmc_now)(INTERP, sub->lex_info, info);
SUPER(info);
}

Expand Down
4 changes: 4 additions & 0 deletions imcc/pbc.c
Expand Up @@ -594,6 +594,10 @@ find_outer(Interp *interpreter, IMC_Unit *unit)
* could be eval too - look, if :outer is the currentsub
*/
current = CONTEXT(interpreter->ctx)->current_sub;
if (! current)
IMCC_fatal(interpreter, 1,
"Undefined :outer sub '%s'.\n",
unit->outer->name);
cur_name = PMC_sub(current)->name;
if (cur_name->strlen == len &&
!memcmp((char*)cur_name->strstart, unit->outer->name, len)) {
Expand Down
12 changes: 11 additions & 1 deletion t/op/lexicals.t
Expand Up @@ -328,6 +328,16 @@ CODE
ok
OUTPUT

pir_output_is(<<'CODE', <<'OUTPUT', ':outer parsing - missing :outer');
.sub main
print "ok\n"
.end
.sub foo :outer(oops)
.end
CODE
Undefined :outer sub 'oops'.
OUTPUT
pir_output_is(<<'CODE', <<'OUTPUT', 'get_lexinfo from pad');
.sub main
.lex '$a', P0
Expand Down Expand Up @@ -866,4 +876,4 @@ OUTPUT
## remember to change the number of tests :-)
BEGIN { plan tests => 35; }
BEGIN { plan tests => 36; }

0 comments on commit d3c1507

Please sign in to comment.