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

glslangValidator mishandles do-while scope rules #2744

Closed
ianromanick opened this issue Aug 30, 2021 · 1 comment · Fixed by #2768
Closed

glslangValidator mishandles do-while scope rules #2744

ianromanick opened this issue Aug 30, 2021 · 1 comment · Fixed by #2768
Assignees

Comments

@ianromanick
Copy link
Contributor

Page 45 of the GLSL 4.60.7 specification says:

The body of a do-while loop introduces a new scope lasting only between the do and while (not including the while test
expression), whether or not the body is simple or compound:

    int i = 17;
    do
        int i = 4; // okay, in nested scope_
    while (i == 0); // i is 17, scoped outside the do-while body

However, when trying to compile this very code from the specification, glslangValidator produces a compilation error:

$ ./install/bin/glslangValidator /tmp/page-45.frag 
/tmp/page-45.frag
ERROR: 0:6: 'i' : redefinition 
ERROR: 0:6: '' : compilation terminated 
ERROR: 2 compilation errors.  No code generated.

I discovered this while discussing another related issue in Mesa in https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/569. As far as I can tell, NVIDIA closed-source drivers correctly compile this code.

@greg-lunarg
Copy link
Contributor

Agree this is a bug.

If anyone decides to work on a solution, please post here to avoid duplicated effort.

@greg-lunarg greg-lunarg self-assigned this Sep 23, 2021
greg-lunarg added a commit to greg-lunarg/glslang that referenced this issue Sep 24, 2021
greg-lunarg added a commit to greg-lunarg/glslang that referenced this issue Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants