[perl #35450] Null pointer dereference in classes/sub.pmc

1 view
Skip to first unread message

Adrian Taylor

unread,
May 14, 2005, 1:15:03 PM5/14/05
to bugs-bi...@rt.perl.org
# New Ticket Created by Adrian Taylor
# Please include the string: [perl #35450]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=35450 >


With pugs revision 3215 and parrot-0.2.0, I get a null pointer
dereference when running this program (on the last line, but
rejigging the program makes it go away). Apologies for reporting this
on an old parrot; I don't know whether pugs can be trusted with newer
parrots. Apologies also that there's no PIR attached... I can't seem
to squeeze it out of pugs. This is running on MacOS X.4.

The same sort of thing happens with various of the Perl6::Rules tests
being run against pugs.

This probably relates to this thread on perl6-compiler:
http://groups-beta.google.com/group/perl.perl6.compiler/browse_frm/
thread/038577a4ba20a869/894fb74ab24ffbc0?hl=en#894fb74ab24ffbc0

===
#!/usr/bin/pugs

use v6;

rule name { Larry | Matz | Guido }
rule project { Perl | Ruby | Python }
rule description { <name> \s does \s <project> }

say('Larry does Perl' ~~ /<description>/);
say(!('Larry does Java' ~~ /<description>/));
===

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x0000000c
0x005fe324 in Parrot_Sub_mark (interpreter=0x1400340, pmc=0x2819fa0)
at classes/sub.pmc:350

345
346 */
347
348 void mark () {
349 struct Parrot_sub * sub = PMC_sub(SELF);
350 if (sub->name)
351 pobject_lives(INTERP, (PObj *) sub->name);
352 if (!PMC_IS_NULL(sub->name_space))
353 pobject_lives(INTERP, (PObj *) sub->name_space);
354 if (!PMC_IS_NULL(sub->multi_signature))


#0 0x005fe324 in Parrot_Sub_mark (interpreter=0x1400340,
pmc=0x2819fa0) at classes/sub.pmc:350
#1 0x0038c924 in Parrot_dod_trace_children (interpreter=0x1400340,
how_many=4294966837) at src/dod.c:471
#2 0x0038c63c in trace_active_PMCs (interpreter=0x1400340,
trace_stack=1) at src/dod.c:389
#3 0x0038d54c in Parrot_dod_ms_run (interpreter=0x1400340, flags=1)
at src/dod.c:1227
#4 0x0038d66c in Parrot_do_dod_run (interpreter=0x1400340, flags=1)
at src/dod.c:1266
#5 0x004c97c4 in more_traceable_objects (interpreter=0x1400340,
pool=0x1407400) at src/smallobject.c:114
#6 0x004c98b8 in gc_ms_get_free_object (interpreter=0x1400340,
pool=0x1407400) at src/smallobject.c:162
#7 0x003ed390 in cst_new_stack_chunk (interpreter=0x1400340,
chunk=0x282ba30) at src/stack_common.c:92
#8 0x003ed424 in stack_prepare_push (interpreter=0x1400340,
stack_p=0x140035c) at src/stack_common.c:117
#9 0x003ebdbc in stack_push (interpreter=0x1400340,
stack_p=0x140035c, thing=0xbfffd1b0, type=STACK_ENTRY_INT, cleanup=0)
at src/stacks.c:253
#10 0x003c6230 in Parrot_save_i (cur_opcode=0x2858b14,
interpreter=0x1400340) at ops/stack.ops:483
#11 0x005706f8 in runops_slow_core (interpreter=0x1400340,
pc=0x2858b14) at src/runops_cores.c:147
#12 0x0038eaf4 in runops_int (interpreter=0x1400340, offset=184) at
src/interpreter.c:741
#13 0x00387fb8 in runops (interpreter=0x1400340, offs=184) at src/
inter_run.c:81
#14 0x00388a68 in runops_args (interpreter=0x1400340, sub=0x2819f10,
obj=0x281dfd0, meth=0x0, sig=0x16491eb "", ap=0xbfffd56c "") at src/
inter_run.c:342
#15 0x00389320 in Parrot_runops_fromc_arglist (interpreter=0x1400340,
sub=0x2819f10, sig=0x16491e8 "SSS", args=0xbfffd564 "\002Aà\230
\002Aàp") at src/inter_run.c:517
#16 0x00322524 in Parrot_call_sub (interpreter=0x1400340,
sub=0x2819f10, signature=0x16491e8 "SSS") at src/extend.c:752
#17 0x0000e908 in s2EpM_info ()
#18 0x00330898 in schedule ()
#19 0x00331458 in waitThread_ ()
#20 0x00331314 in scheduleWaitThread ()
#21 0x00333074 in rts_evalLazyIO ()
#22 0x00307d5c in main ()

Leopold Toetsch

unread,
May 15, 2005, 8:55:32 AM5/15/05
to perl6-i...@perl.org
Adrian Taylor <parrotbug...@parrotcode.org> wrote:

I can't reproduce the segfault, when running:

> rule name { Larry | Matz | Guido }
> rule project { Perl | Ruby | Python }
> rule description { <name> \s does \s <project> }

> say('Larry does Perl' ~~ /<description>/);
> say(!('Larry does Java' ~~ /<description>/));

#v+

$ ./pugs at.p6
Larry does Perl
Bus error
$ ./pugs -BParrot at.p6
pugs: cannot cast from VError "fnord" (NonTerm (MkPos "at.p6" 1 1 1 1)) to [Char]
$ ./pugs --version
/\____/ Version: 6.2.3 (r3253)
$ ../../parrot/leo/parrot --version
This is parrot version 0.2.0-devel (r8082) built for ppc-darwin.

Adrian Taylor

unread,
May 15, 2005, 12:26:29 PM5/15/05
to l...@toetsch.at, perl6-i...@perl.org, parrotbug...@parrotcode.org
Hi Leo,

OK, you've confused me now :-) You're getting the same results as me
(which I also get with the latest parrot, shown below).

The Bus error from the first pugs command is what I'm reporting as a
bug - you can reproduce that. The callstack from that error suggests
that pugs is using parrot for PGE stuff, even without -BParrot. It's
that parrot code that is failing.

So what am I missing? Thanks in advance for any newbie cluebats which
may be required.

Ade

[Ades-G4:Development/pugs/pugs] ade% ./pugs ../example.pl


Larry does Perl
Bus error

[Ades-G4:Development/pugs/pugs] ade% ./pugs -BParrot ../example.pl
pugs: cannot cast from VError "fnord" (NonTerm (MkPos "../example.pl"

1 1 1 1)) to [Char]

[Ades-G4:Development/pugs/pugs] ade% ./pugs --version
/\____/ Version: 6.2.3 (r3258)

[Ades-G4:Development/pugs/pugs] ade% ../parrot/parrot/parrot --version
This is parrot version 0.2.0-devel (r8105) built for ppc-darwin.

Leopold Toetsch

unread,
May 17, 2005, 10:26:30 AM5/17/05
to Adrian Taylor, perl6-i...@perl.org
Adrian Taylor <a...@hohum.me.uk> wrote:
> Hi Leo,

> OK, you've confused me now :-) You're getting the same results as me
> (which I also get with the latest parrot, shown below).

I had missed that Parrot is run anyway.

Should be fixed now as of Parrot rev 8110.
leo

Reply all
Reply to author
Forward
0 new messages