Bug report: error C7565: assignment to varying 'x'


The following valid GLSL fragment shader fails to compile. It works fine on AMD and Intel drivers.

#version 130

float x;

void timestwo(inout float z) {
    z *= 2;

float f(float x) {
    return x;

void main()
    gl_FragColor = vec4(1.0, 0.0, f(0.5), 1.0);

Info log:

0(10) : error C7565: assignment to varying 'x'
0(16) : warning C7533: global variable gl_FragColor is deprecated after version 120
  1. Operating system version: Windows 7 64-bit
  2. Graphics hardware: Geforce GTX 1060 6GB
  3. Graphics driver version: 391.01
  4. Reproducer project: see the shader above
  5. Description of single steps to reproduce the problem: try to compile the given shader source
  6. Description of the expected result: shader should compile without any errors

gl_FragColor is deprecated. the preferred usage is to explicitly declare these outputs in the fragment shader.

Thank you for your reply qgu.

I am aware that gl_FragColor is deprecated but that isn’t the real issue here.
The problem is the error “assignment to varying ‘x’” caused by line 10. It shouldn’t happen as the code is legal.

Please look into the issue since the bug is very inconvenient.

We’re now tracking this as NVIDIA bug 2186451. Thank you for reporting.

Thank you. Apparently on latest 398.11 drivers this bug has been already fixed.

This issue can be considered solved.