laurentlb/shader-minifier

Variable scoping bug

therontarigo opened this issue · 0 comments

Testing with --no-inlining, else the problem is masked by inlining.
Input:

  vec2 r;
  int i=1;
  for (int i=2; i<3; i++) r.x=i;
  r.y=i;

Output:

  vec2 f;
  int m=1,i=2;
  for(;i<3;i++)
    f.x=i;
  f.y=i;

The last line should be f.y=m;

before 5b8f945:

  vec2 f;
  int m=1;
  for(int i=2;i<3;i++)
    f.x=i;
  f.y=m;