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

Option<[u8]>::none() panics at SSA #5429

Closed
michaeljklein opened this issue Jul 5, 2024 · 2 comments · Fixed by #5592
Closed

Option<[u8]>::none() panics at SSA #5429

michaeljklein opened this issue Jul 5, 2024 · 2 comments · Fixed by #5592
Assignees
Labels
bug Something isn't working

Comments

@michaeljklein
Copy link
Contributor

Aim

Ran nargo compile on:

fn main() {
    let _: Option<[u8]> = Option::none();
}

Expected Behavior

The program to compile without errors

Bug

❯ nargo compile
The application panicked (crashed).
Message:  internal error: entered unreachable code: ICE: unexpected array literal type, got [u8]
Location: compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs:203

To Reproduce

Project Impact

None

Impact Context

No response

Workaround

None

Workaround Description

No response

Additional Context

No response

Installation Method

None

Nargo Version

nargo version = 0.31.0 noirc version = 0.31.0+7b77bbfc19c51829814149e623257a3424d8e8c2 (git version hash: 7b77bbf, is dirty: true)

NoirJS Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@michaeljklein michaeljklein added the bug Something isn't working label Jul 5, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Jul 5, 2024
@asterite
Copy link
Collaborator

This also reproduces the same issue:

fn main() {
    let _: [u8] = std::unsafe::zeroed();
}

@noir-lang/core Is there a way for zeroed to work on slices? Maybe it's just a tuple (0, 0)?

@jfecher
Copy link
Contributor

jfecher commented Jul 23, 2024

@asterite should just be an empty slice &[]. IIRC we already do this as well.

@asterite asterite self-assigned this Jul 23, 2024
github-merge-queue bot pushed a commit that referenced this issue Jul 23, 2024
# Description

## Problem

Resolves #5429

## Summary

An incorrect type literal type was being passed.

## Additional Context

None.

## Documentation

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

3 participants