This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
threads::shared "$#shared = N" off-by-one error
authorDavid Mitchell <davem@iabyn.com>
Mon, 13 Oct 2014 11:45:14 +0000 (12:45 +0100)
committerDavid Mitchell <davem@iabyn.com>
Tue, 14 Oct 2014 11:33:06 +0000 (12:33 +0100)
commit399547d72ff67024bd23426fc6e6aa2593d47a9e
tree5fb87e64effa241f683d41a1758c04832e90a91f
parent0561e60b8176e7cda2f409814c660336f3e25fb6
threads::shared "$#shared = N" off-by-one error

RT #122950

    my @a : shared;
    $#a = 3;  # actually set it to 4

There was a simple off-by-one error in the XS code that handled the
STORESIZE tie method (confusing the array size and fill, which differ
by 1).

Amazingly, there was no test for it, and no-one had noticed up until now.

Note that this commit causes three tests in object2.t to fail: this
is because fixing the $#shared bug exposed another bug that was being
masked by this one. They will be fixed in the next commit
dist/threads-shared/lib/threads/shared.pm
dist/threads-shared/shared.xs
dist/threads-shared/t/av_simple.t