I have found a way to segfault parrot. (I know that the following code is 
incorrect):

[EMAIL PROTECTED]/prg/parrot$ cat hello.pasm 
main:
        set I0, 3
        set I1, 2
        get_results "(0)", I0
        set_args "(0,0)", P0, I1
fakesub:
        get_params "(0,0)", I0, I1
        add I0, I0, I1
        set_returns "(0)", I0
        returncc
[EMAIL PROTECTED]/prg/parrot$ parrot hello.pasm 
Segmentation fault

The segfault can be avoided by changing:
        set_args "(0,0)", P0, I1
 for
        set_args "(0,0)", I0, I1

It only happens with 'P', not fot 'S' or 'I'. ://


I have been able to use subroutines in .pir and it works,
but there is any subroutine example for pasm?

-------------------------------------
.sub main :main
        set I0, 3
        set I1, 2
        get_results "(0)", I0
        set_args "(0,0)", I0, I1
        find_global P5, "foo"
        invokecc P5
        print I0
        print "\n"
.end

.sub foo
        get_params "(0,0)", I0, I1
        print I0
        print " + "
        print I1
        print " = "
        add I0, I0, I1
        set_returns "(0)", I0
        returncc
.end
----------------------------------------

Thanks

  --pancake

Reply via email to