I just started playing with Parrot assembly and it looks like I have
found a bug with entrytype OP.

This test case causes segfault:

        save I1
        entrytype I2, 0

Another test case

        save I1
        entrytype I2, -1

This one causes 'Stack Depth wrong' error instead of getting type for
entry from the bottom of stack.

BTW from POD docs in core.ops it is not very clear what second
parameter of this OP is for.  I rewrote documentation for this OP
basing on comments from stack.c for stack_entry():

Index: core.ops
===================================================================
RCS file: /cvs/public/parrot/core.ops,v
retrieving revision 1.130
diff -u -d -u -r1.130 core.ops
--- core.ops    24 Apr 2002 20:31:39 -0000      1.130
+++ core.ops    29 Apr 2002 14:48:49 -0000
@@ -2506,7 +2506,10 @@
 
 =item B<entrytype>(out INT, in INT)
 
-Gets the type of entry $2 of the stack and puts it in $1
+If $2 >= 0, gets the type of entry at that depth from the top of the
+stack and puts it in $1, with 0 being the top entry.  If $2 < 0, then
+gets the type of entry |$2| entries from the bottom of the stack and
+puts it in $1.
 
 =cut
 



-- 
Ilya Martynov (http://martynov.org/)

Reply via email to