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

Comptime soundness issue in if expressions #793

Closed
jfecher opened this issue Feb 9, 2023 · 2 comments · Fixed by #2178
Closed

Comptime soundness issue in if expressions #793

jfecher opened this issue Feb 9, 2023 · 2 comments · Fixed by #2178
Assignees
Labels
bug Something isn't working

Comments

@jfecher
Copy link
Contributor

jfecher commented Feb 9, 2023

Description

Aim

fn main(x: bool) {
    let foo = if x { 1 } else { 2 };
    ...
}

Expected behavior

Expected foo to be a Field rather than a comptime Field since its value depends on a private input to the circuit.

Bug

foo is incorrectly typed as a comptime Field which can cause compiler panics when later attempting to use it as an array index.

@jfecher jfecher added the bug Something isn't working label Feb 9, 2023
@jfecher jfecher changed the title Comptime soundness issue Comptime soundness issue in if expressions Feb 9, 2023
@kevaundray
Copy link
Contributor

@jfecher whats the status of this issue?

@jfecher
Copy link
Contributor Author

jfecher commented Jul 17, 2023

@kevaundray still open and unchanged. I haven't worked on it in case we wanted to remove comptime after dynamic indexing is enabled.

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
None yet
Development

Successfully merging a pull request may close this issue.

2 participants