glslang icon indicating copy to clipboard operation
glslang copied to clipboard

Code with unary plus is recognized as l-value

Open AaronGhost opened this issue 3 years ago • 2 comments

The following code with a (useless) unary plus is validated by glslangvalidator while it should raise an error for the assignment to a non-lvalue.

It correctly raise an error for the unary minus.

#version 320 es

void main() {
  int var1 = 5;
  int var2 = + var1 += 3;  
}

AaronGhost avatar May 10 '21 14:05 AaronGhost

If someone wishes to submit a fix, please make a note on this issue to avoid duplicate effort.

greg-lunarg avatar May 10 '21 19:05 greg-lunarg

I am guessing that the + is removed to simplify downstream checking where the + is superfluous. So the trick will be to catch this error without breaking analysis downstream.

greg-lunarg avatar May 10 '21 19:05 greg-lunarg