Skip to content

Leading comma in variable declaration block silently breaks lexer #505

@LJ1102

Description

@LJ1102

Found a nice little edgecase here, notice the declaration list in the test function beginning with a leading comma, this was actually just a typo from moving a bunch of declarations around and optimizing them, however it seems to be valid (neither intel nor nvidia driver complained; shader works as intended), the minifier while not complaining breaks the code by not renaming the variables but dropping the type, older versions left the declaration intact but still didn't optimize the names.

#version 430
float test(){
	float
            ,hello=22
            ,there=32
        ;
	hello += hello*(hello-5)*there;
	return hello;
}
out vec4 OUT;
void main(){
	OUT=vec4(test());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions