Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler panic on indexing empty literal arrays #4001

Open
ritzdorf opened this issue Apr 25, 2024 · 0 comments · May be fixed by #4034
Open

compiler panic on indexing empty literal arrays #4001

ritzdorf opened this issue Apr 25, 2024 · 0 comments · May be fixed by #4034
Labels
bug - type 0 compiler halts or panics instead of generating code sev - low

Comments

@ritzdorf
Copy link
Contributor

Version Information

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

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
@cyberthirst cyberthirst transferred this issue from another repository May 4, 2024
@charles-cooper charles-cooper transferred this issue from another repository May 4, 2024
@charles-cooper charles-cooper added the bug - type 0 compiler halts or panics instead of generating code label May 4, 2024
@charles-cooper charles-cooper changed the title Indexing Empty Arrays Not Prevented compiler panic on indexing empty literal arrays May 4, 2024
@tserg tserg linked a pull request May 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug - type 0 compiler halts or panics instead of generating code sev - low
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants