I've been tinkering with the queens.jako example, trying to make it work 
with strings
instead of bit fields. Along the way, I had a parrot segfault aparently 
due to substr
and a (null) string register. Its probably my fault such a call was being 
made, but
I was surprised to see the result was a segfault.

Consider this program:

        substr S0, 0, 1, " " # S0 is (null) here in a fresh interpreter
        print S0
        end

Should it:

        (a) Silently do something, such as print " " (but what if it were 
substr S0, 5, 2, " ")?
        (b) Complain, but do something, such as print " " (same "what if" 
as above)?
        (c) Complain and die?
        (d) Be undefined behavior until we have exceptions, at which point 
it will (c)?
        (e) Something else?

I think any time Parrot segfaults it represents a bug. If no external code 
has been
loaded, it is a Parrot bug for sure.


BTW, I added the above test to my local copy of t/op/string.t, but for 
whatever
reason it doesn't segfault there. I would expect it to behave exactly as 
it does
outside the harness, unless the harness is reusing an interpreter, which 
means
its not testing what the code fragments would do in a fresh interpreter...


Regards,

-- Gregor

Reply via email to