internal compiler error + minimal sample, "Name "@a-0001" shouldn't be defined, but i


I’m working on a tool to minimize shader code size after compression. One aspect is to re-use variable names as much as the OpenGl spec allows, for better compression rates, and this triggers an internal compiler bug in recent Nvidia driver.

Here is a minimal code snippet that reproduces it:

float a;
vec4 b(float c)
    float a=1;
    return c.xxxx;
void main(void)

This gives the errors: error C9999: Name “@a-0001” shouldn’t be defined, but is!
and: error C1038: declaration of “@a-0001” conflicts with previous declaration at 0(11)

The issue seems to be the declaration and initialisation of a local variable (a) with the same name as a global variable, if that global variable has been used in the same scope. This is perfectly fine according to the OpenGL scope rules, the local variable should simply hide the global variable for the rest of the scope.

This has happened at least since the notebook driver version before the 364.72 one, and still happens in 368.39. It did not happen in drivers from about one year ago (not certain, I don’t update the drivers on that laptop very often). It also doesn’t happen on AMD cards.

Kind regards,

Thanks for reporting this issue.
It has been identified and fixed in an internal driver version by the compiler team.
At this time I cannot say which public driver release version will pick up the fix.