Code with multiple dynamically-sized variables works incorrectly?

pragma solidity ^0.4.11;

contract Test {
    uint[] public a = [0];
    uint[] public b = [0];
    mapping(uint => uint) public c;
    mapping(uint => uint[2]) public d;
    mapping(uint => uint) public e;

    function putX(uint x) public {
        a.push(x);
        b.push(block.number);
        c[x] = block.number;
        d[x] = [x, block.number];
        e[x] = x + 1;
    }

    function getA() public view returns (uint[]) {
        return a;
    }

    // ... Other getter functions
}
The code snippet above does not work with geth 1.7 stable. Output:
> test.putX.sendTransaction(11, {from: eth.accounts[0]})
... Waiting for a long-enough time
> test.getA()
[0]
However, if the code only has array a and array b (i.e., it does not have c, d and e), it works. Output:
> test.putX.sendTransaction(11, {from: eth.accounts[0]})
... Waiting for a long-enough time
> test.getA()
[0, 11]
I really don't know why this happened. Most importantly, the first code snippet works perfectly in Remix.
I think what the code snippet does is a very basic function and should not have any problem, so I'm wondering if what I have done is wrong.
Many thanks!
Sign In or Register to comment.