Skip Menu |
Report information
Id: 126492
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: elizabeth <liz [at]>

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)

Subject: native str attributes need initialization to prevent segfault
To: rakudobug [...]
Date: Thu, 29 Oct 2015 21:43:05 +0100
From: Elizabeth Mattijsen <liz [...]>
Download (untitled) / with headers
text/plain 900b
[21:38:17] <lizmat> m: use nqp; class A { has str $!a; method BUILD() { nqp::chars($!a) } }; # tada [21:38:18] <+camelia> rakudo-moar 3cc195: OUTPUT«(signal SEGV)» [21:38:46] <lizmat> m: use nqp; my str $foo; say $foo [21:38:46] <+camelia> rakudo-moar 3cc195: OUTPUT«␤» [21:39:05] <lizmat> I always thought that native strings initialized to the empty string ? [21:39:23] <lizmat> jnthn: ^^^ ?? [21:39:46] <jnthn> lizmat: In Rakudo I think we make that happen. [21:39:50] <jnthn> In NQP maybe not [21:39:51] <lizmat> m: use nqp; my str $foo; say nqp::chars($foo) [21:39:51] <+camelia> rakudo-moar 3cc195: OUTPUT«0␤» [21:40:17] <lizmat> apparently it only goes wrong with native string attributes ? [21:40:41] <lizmat> jnthn: this is rakudo, so bug? [21:41:39] <jnthn> lizmat: oh, mis-read... [21:41:58] <jnthn> Yeah, bug then [21:42:10] <lizmat> ok, will rakudobug it
Subject: [BUG] native str attributes default to null instead of empty string
Download (untitled) / with headers
text/plain 400b
Doesn't segfault for me on... Rakudo version 2016.04-155-gdc7346b built on MoarVM version 2016.04 implementing Perl 6.c. ...and instead prints this error: ➜ use nqp; my str $a; say nqp::chars($a); 0 ➜ use nqp; class A { has str $!a; method BUILD() { nqp::chars($!a) } };; chars requires a concrete string, but got null I'm renaming the ticket accordingly.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at