shaderc icon indicating copy to clipboard operation
shaderc copied to clipboard

Incorrect structure field in function call argument not reported

Open jdyb opened this issue 1 year ago • 0 comments

Hello!

I was refactoring a shader, made a mistake and stumbled on this behavior in glslc which I think is probably a bug.

Consider the following small example code:

#version 450

struct S {
  uint x;
};

void f(uint a) { }

void main() {
  S q = { 1 };
  f(q.y); // Field name is wrong.
}

Compiling this program produces no output warning or error from the glslc compiler. Currently using the following versions on Windows 10, version 21H2.

  • shaderc v2021.3 v2021.3
  • spirv-tools v2021.4 v2021.4
  • glslang 11.1.0-316-g600c5037
  • Target: SPIR-V 1.0

(Since I am in the middle of some performance profiling and do not wish to change compiler versions right now I will try again with more up to date versions later and report back here.)

So, is this expected behavior? Or have I misunderstood something about GLSL? (This is my first project using shaderc for separate compilation, so that may be the case.) I did some quick searching amongst the issues of this repo but I did not find anything that seemed related.

Best wishes, Jon

jdyb avatar Jul 26 '22 21:07 jdyb