vyper icon indicating copy to clipboard operation
vyper copied to clipboard

compiler panic on indexing empty literal arrays

Open ritzdorf opened this issue 1 year ago • 0 comments

Version Information

  • vyper Version (output of vyper --version OR linkable commit hash vyperlang/vyper@): vyperlang/vyper@b43fface148b45cbd2c90b5d24f77398a63745b5

Issue Description

Indexing an empty array is not caught by the type checker and causes the code generation to fail with a compiler panic.

POC

Compiling the following contract will cause a compiler panic:

@external
def bar(x:uint128):
    a:uint128 = empty(DynArray[uint128,2])[0]
vyper.exceptions.TypeCheckFailure: indexing into zero array not allowed

ritzdorf avatar Apr 25 '24 15:04 ritzdorf