Open
Description
When we resize an array by assigning to length, the new elements are not set to their default value (except in the constructor). We should give at least give a warning (bug) as long as it is not implemented (enhancement).
pragma solidity >=0.5.0;
contract Issue097 {
int[] arr;
constructor() public {
arr.length += 1;
assert(arr[arr.length-1] == 0);
}
function() external payable {
arr.length += 1;
assert(arr[arr.length-1] == 0);
}
}
$ solc-verify.py issues/Issue097.sol
Issue097::[constructor]: OK
Issue097::[fallback]: ERROR
- issues/Issue097.sol:13:9: Assertion might not hold.
Errors were found by the verifier.