google / google/shaderc

Incorrect structure field in function call argument not reported

Open
#1,258 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.2k
Forks
445
Avg merge
11h 6m
Merged PRs (30d)
6

Description

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:

```glsl
#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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.