Ticket #1668 (closed bug: fixed)

Opened 5 years ago

Last modified 5 years ago

NQP: Problem with arrays when unshifting/pushing

Reported by: bluescreen Owned by: pmichaud
Priority: normal Milestone:
Component: nqp Version: 2.3.0
Severity: medium Keywords:
Cc: Language:
Patch status: Platform: linux

Description

The following snippet is part of actions.pm of the language I'm trying to implement,

method TOP($/,$key) {
    our @?BLOCK;
    our $?BLOCK;
    my $past;

    if $key eq 'open' {
        $?BLOCK := PAST::Block.new( :blocktype('declaration'), :node( $/ ) );
        $?BLOCK.symbol_defaults( :scope('package') );
        say("before unshifting/shifting");
        @?BLOCK.unshift($?BLOCK);
        say(+@?BLOCK);
        @?BLOCK.shift();
        say("after unshifting/shifting" );

it compiles ok but in runtime it get the following error

before unshifting/shifting
0
ResizablePMCArray: Can't shift from an empty array!

If preload @?BLOCK with bogus data it works for example:

@?BLOCK := (1,2);

In this case it doesn't fail. In #parrot plobsing mentioned that could be a problem with autoviv.

Attachments

bug.nqp Download (118 bytes) - added by bluescreen 5 years ago.
bug.nqp

Change History

Changed 5 years ago by bluescreen

bug.nqp

Changed 5 years ago by bluescreen

Step to reproduce:

parrot parrot-2.3.0/compilers/nqp/nqp.pbc bug.nqp 

Changed 5 years ago by coke

  • status changed from new to closed
  • resolution set to fixed

NQP is no longer available (2.3.0 was its last supported release), please use 'parrot-nqp' instead.

In parrot trunk:

$ ./parrot-nqp bug.nqp
1

Regards.

Note: See TracTickets for help on using tickets.