Open aleksander-mendoza opened 2 years ago
As you may know, the name length is a pre-defined method for all array, vector and matrix types. It is also the name of a set of built-in functions which can be redefined by the user.
It is true that the GLSL spec does not explicitly say that the name length cannot be used in this context. It also seems that a more "enlightened" front-end might actually allow such a use. Still, fixing this problem will likely not rise to the top of my work queue in the near future.
In the meantime, I would suggest the workaround of renaming this member.
glslangValidator does not segfault on Windows, although it does give a not-entirely-correct error message so I will keep this issue open. We will shortly investigate if this segfault can be reproduced with glslangValidator on ubuntu. If it cannot, I will suggest you open an issue with shaderc.
glslangValidator on ubuntu does not crash but gives pretty much the same error as on Windows:
john@neon:/tmp$ glslangValidator -V --target-env spirv1.0 -o t.comp.spv t.comp
t.comp
ERROR: t.comp:17: 'length' : does not operate on this type: layout( column_major std430 offset=0) restrict temp structure{ global highp uint length, layout( std430) global 7-element array of highp uint contents}
ERROR: t.comp:17: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link
Please submit the segfault crash to shaderc.
I will change the title of this issue to better fit the glslangValidator behavior.
I have a compute shader that looks like
When I run
glslc my_shader.comp -o o.spv
I getSegmentation fault (core dumped)
. However, if I renamelength
variable to something else, the compilation passes successfully.My compiler version
My system
Vulkan