1 Reply Latest reply on Jul 19, 2018 10:11 PM by xhuang

    GLSL bug in 18.3.4 drivers: Variable expected

    svnfulcr

      Hello,

       

      I've found a reproducible GLSL bug that still happens after updating to the 18.3.4 drivers. It occurs when a global variable and a for-loop variable share the same name, with some additional complexity. I've cut the code down to the following minimal sample that doesn't do anything useful but still triggers the error:

       

      float a=0;

      void main()

      {

          for(int a=0;a<10;a++)

              if(a==9)

                  break;         

          a=0;    

          gl_FragColor.rgb=vec3(a);

         }

       

      The error is "Variable expected:a" on the line "a=0;" Clearly, at this point the local "a" should already be out of scope and the global "a" should be used, but for some reason the compiler is confused. Removing the "a=0;" line causes the bug to vanish, as does removing the "if(a==9)" line (probably then the entire loop gets optimized away).

       

      Greets,

      Svn/Fulcr