Hi, make_COW_reference in src/string.c does not check for a NULL string. Due to this, parrot crashes if the join OP is used and a PMC's __get_string method returns a null string.
A test case (patch against t/op/string.t) as well as a patch (against src/string.c) is attached to the message. jens
Index: src/string.c =================================================================== RCS file: /cvs/public/parrot/src/string.c,v retrieving revision 1.191 diff -u -w -r1.191 string.c --- src/string.c 15 Apr 2004 11:11:50 -0000 1.191 +++ src/string.c 16 Apr 2004 10:26:35 -0000 @@ -146,6 +146,9 @@ make_COW_reference(struct Parrot_Interp *interpreter, STRING *s) { STRING *d; + if (s == NULL) { + return NULL; + } if (PObj_constant_TEST(s)) { PObj_constant_CLEAR(s); d = new_string_header(interpreter, PObj_get_FLAGS(s)); Index: t/op/string.t =================================================================== RCS file: /cvs/public/parrot/t/op/string.t,v retrieving revision 1.73 diff -u -w -r1.73 string.t --- t/op/string.t 13 Apr 2004 14:18:33 -0000 1.73 +++ t/op/string.t 16 Apr 2004 10:26:39 -0000 @@ -16,7 +16,7 @@ =cut -use Parrot::Test tests => 131; +use Parrot::Test tests => 132; use Test::More; output_is( <<'CODE', <<OUTPUT, "set_s_s|sc" ); @@ -2386,6 +2386,40 @@ a--b OUTPUT +output_is( <<'CODE', <<OUTPUT, "join: __get_string returns a null string"); +##PIR## +.sub _main + newclass P0, "Foo" + + new P0, .PerlArray + + find_type I0, "Foo" + new P1, I0 + + push P0, P1 + + print "a" + join S0, "", P0 + print "b" + print S0 + print "c\n" + end +.end + +.namespace ["Foo"] + +.sub __get_string method + .local string ret + + null ret + .pcc_begin_return + .return ret + .pcc_end_return +.end +CODE +abc +OUTPUT + output_is( <<'CODE', <<OUTPUT, "eq_addr/ne_addr"); set S0, "Test" set S1, S0 @@ -2430,4 +2464,3 @@ OUTPUT 1; -