# New Ticket Created by  Geoffrey Broadwell 
# Please include the string:  [perl #54220]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=54220 >


The attached short PIR program shows the problem -- parrot segfaults on
the first shift operation when iterating over a namespace.


-'f

# The following test program segfaults when attempting to iterate:
# 
#   $ ./parrot namespace_iter.pir
#   Symbols found: 81
#   Segfaults on next line ...
#   Segmentation fault


.sub main :main
    .local pmc my_namespace
    my_namespace = get_namespace

    .local int num_symbols
    num_symbols = elements my_namespace
    print 'Symbols found: '
    print num_symbols
    print "\n"

    .local pmc iterator, symbol
    iterator = new 'Iterator', my_namespace
  iter_loop:
    unless iterator goto iter_end

    print "Segfaults on next line ...\n"
    symbol = shift iterator
    print "Never reached!\n"

    print symbol
    print "\n"
    goto iter_loop
  iter_end:
.end

Reply via email to