# New Ticket Created by Jos Visser # Please include the string: [perl #23159] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=23159 >
------------------------------------------------------------------------ Description: ------------------------------------------------------------------------ The following PIR code causes parrot to dump core: .sub _main find_lex $P1,"n" print $P1 print "\n" end .end ------------------------------------------------------------------------ Failing routine: ------------------------------------------------------------------------ Under GDB it says: Program received signal SIGSEGV, Segmentation fault. 0x080a4323 in scratchpad_find (interp=0x817f2f8, pad=0x0, name=0x40408b5c, position=0xbfffd850) at sub.c:180 180 for (i = pad->cache.int_val - 1; i >= 0; i--) { ------------------------------------------------------------------------ Reason: ------------------------------------------------------------------------ Variable "pad" is NULL! ------------------------------------------------------------------------ Additional comments: ------------------------------------------------------------------------ Trying to find a lexical when no pad is established is stupid. However, I don't guess dumping core is the appropriate thing to do, returning NULL from scratchpad_find probably is. ------------------------------------------------------------------------ Patch: ------------------------------------------------------------------------ I don't know if this is the appropriate patch, but still.... Index: sub.c =================================================================== RCS file: /cvs/public/parrot/sub.c,v retrieving revision 1.28 diff -u -b -B -r1.28 sub.c --- sub.c 21 Jul 2003 18:00:24 -0000 1.28 +++ sub.c 29 Jul 2003 13:35:55 -0000 @@ -177,6 +177,9 @@ INTVAL i, pos = 0; struct Parrot_Lexicals * lex = NULL; + if (!pad) + return NULL; + for (i = pad->cache.int_val - 1; i >= 0; i--) { lex = &(((struct Parrot_Lexicals *)PMC_data(pad))[i]); pos = lexicals_get_position(interp, lex, name); With this patch I get the error message "Lexical 'n' not found".. Yours truly, Jos Visser -- ek is so lug jy vlieg deur my sonder jou is ek sonder patroon "Breyten Breytenbach"