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

[wgsl-in] panic on malformed input #2209

Closed
jimblandy opened this issue Jan 16, 2023 · 1 comment · Fixed by #2233
Closed

[wgsl-in] panic on malformed input #2209

jimblandy opened this issue Jan 16, 2023 · 1 comment · Fixed by #2233
Labels
area: front-end Input formats for conversion kind: bug Something isn't working lang: WGSL WebGPU shading language

Comments

@jimblandy
Copy link
Member

The following program causes Naga to panic:

fn S()3-array<f32,0f>()=v}

The crash:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/front/wgsl/mod.rs:1388:83
@jimblandy jimblandy added kind: bug Something isn't working lang: WGSL WebGPU shading language area: front-end Input formats for conversion labels Jan 16, 2023
@teoxoy teoxoy added this to the WGSL Specification V1 milestone Jan 16, 2023
@SparkyPotato
Copy link
Contributor

SparkyPotato commented Jan 18, 2023

Due to #2216, the above code is transformed to

fn S() {
    -array<f32, 0f>() = v
}

(There seems to be another bug in the parser where it doesn't error on the missing ;, somehow array<f32, 0f> = v errors correctly in the parser)

It can be further lowered into

fn S() {
    let x = array<f32, 0f>();
}

The unwrap occurs when lowering zero-value arrays with invalid sizes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: front-end Input formats for conversion kind: bug Something isn't working lang: WGSL WebGPU shading language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants