From e17ef84753050c60dc54d38fd0bfeac79c154436 Mon Sep 17 00:00:00 2001
From: John Kessenich <cepheus@frii.com>
Date: Mon, 28 Oct 2013 19:49:16 +0000
Subject: [PATCH] Fix bug where bracket dereferences were incorrectly keeping
 the base's qualifier (for example constBase[i] would still be a const instead
 of EvqTemporary).

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23722 e7fa87d3-cd2b-0410-9028-fcbf551c1848
---
 Install/Windows/glslangValidator.exe          | Bin 369664 -> 369664 bytes
 Test/420.geom                                 |  24 +++++-
 Test/baseResults/100Limits.vert.out           |  38 ++++-----
 Test/baseResults/120.frag.out                 |   8 +-
 Test/baseResults/130.frag.out                 |   2 +-
 Test/baseResults/140.frag.out                 |   2 +-
 Test/baseResults/150.geom.out                 |   6 +-
 Test/baseResults/300.frag.out                 |   4 +-
 Test/baseResults/300.vert.out                 |   2 +-
 Test/baseResults/300block.frag.out            |   4 +-
 Test/baseResults/300layout.frag.out           |   2 +-
 Test/baseResults/330.frag.out                 |   2 +-
 Test/baseResults/330comp.frag.out             |   2 +-
 Test/baseResults/400.frag.out                 |   6 +-
 Test/baseResults/400.geom.out                 |   2 +-
 Test/baseResults/410.geom.out                 |   2 +-
 Test/baseResults/420.geom.out                 |  80 ++++++++++++++++--
 Test/baseResults/420.vert.out                 |   4 +-
 Test/baseResults/array.frag.out               |  14 +--
 Test/baseResults/array100.frag.out            |  14 +--
 Test/baseResults/dataOut.frag.out             |   2 +-
 Test/baseResults/dataOutIndirect.frag.out     |   2 +-
 Test/baseResults/length.frag.out              |   4 +-
 Test/baseResults/link1.frag.out               |   4 +-
 Test/baseResults/matrix.frag.out              |   2 +-
 Test/baseResults/structure.frag.out           |   6 +-
 Test/baseResults/uniformArray.frag.out        |   6 +-
 Test/baseResults/variableArrayIndex.frag.out  |   2 +-
 Test/baseResults/varyingArray.frag.out        |  10 +--
 .../baseResults/varyingArrayIndirect.frag.out |  12 +--
 glslang/MachineIndependent/ParseHelper.cpp    |   6 +-
 31 files changed, 185 insertions(+), 89 deletions(-)

diff --git a/Install/Windows/glslangValidator.exe b/Install/Windows/glslangValidator.exe
index 41819bcc0a65fec7c69ad1566619230f87e0ad98..248a1e4ffc51d0c8599c60ae77c5b9afb6118d37 100644
GIT binary patch
delta 270
zcmZoTA=Yq0Yyl%v;@)N^#_dduj4NNrW-u}^F#Hb?>2`4VU!o$?%@Eej(CMO*5Z>#e
zlCu58OU9>6j5gEPy<xP_-Un2f1%iwqve!q&=EdaRfB(DLyU!nYQK?`C8{`lGl+c+j
z_?A)1M82E3`}F^SfNlmAdmE-wfo>NSi{=N1nolqRZLoOF+MJ?daR8`X<Hhr(Ky%nY
z%;^zt8D$wCOfP%OsLB{Mea>4(87|AIj10|3G7bqaw4Z#-xc%f?ra${Q*Ss{n_~(DG
z@0#uB)-baP$|dg23j(@;feDCxfH*^ql_5ij6(q!vxVQb&Ugqte_Of(^FdpAtE5zD7
F5daK8V@&`6

delta 292
zcmZoTA=Yq0Yyl(Frsd5{jN6$Q8CSlLwP0jmVE7*(((T~zzeGi(n<1>5q0>dhAiUQ_
z#bo=5myA!D7z3uSd&6j<y&b4B3j`TKWUr4(z>CSf|NeKgcb`A*qEf*OHpn3WDB&<&
z@GYa1u534R_v!xu0o@EL_BKqVeBCZ8KFtpfHJ@Mt+Ta6JXY=CSQlJ5BAm;S=w~Vrk
z&!^YEWmMHm6lY-QKGyA{QjpTg3pAG@GCnRg8pw|@KJ&t1DkDSlk&HtE3}+yq{p4H5
z?I+(d{n^KP;HBxsKmU7u4{SfThM7%JZqxF-Adr40Aoc;`3^i7U3?WvK5W}YB?Vt8C
TZ~wHHr7MK-*!Ef>*5-)-L*Q+d

diff --git a/Test/420.geom b/Test/420.geom
index 9740799cf..49c6fccf8 100644
--- a/Test/420.geom
+++ b/Test/420.geom
@@ -1,4 +1,4 @@
-#version 150 core
+#version 420 core
 
 // testing input arrays without a gl_in[] block redeclaration, see 400.geom for with
 
@@ -21,3 +21,25 @@ void foo3()
     gl_in[i].gl_Position;
     color3.length();
 }
+
+uniform sampler2D s2D;
+in vec2 coord;
+uniform vec4 v4;
+
+void foo4()
+{
+    const ivec2 offsets[5] =
+    {
+        ivec2(0,1),
+        ivec2(1,-2),
+        ivec2(0,3),
+        ivec2(-3,0),
+        ivec2(2,1)
+    };
+
+    vec4 v = textureGatherOffset(s2D, coord, offsets[i].xy);
+
+    offsets[i].xy = ivec2(3);  // ERROR
+    v4.x = 3.2;                // ERROR
+    v4.xy;   // should have non-uniform type
+}
diff --git a/Test/baseResults/100Limits.vert.out b/Test/baseResults/100Limits.vert.out
index 4ee83d137..e8a297b63 100644
--- a/Test/baseResults/100Limits.vert.out
+++ b/Test/baseResults/100Limits.vert.out
@@ -288,32 +288,32 @@
 0:43            'a' (highp float)
 0:43            Constant:
 0:43              2.000000
-0:47      indirect index (uniform lowp sampler2D)
+0:47      indirect index (lowp sampler2D)
 0:47        'fsa' (uniform 3-element array of lowp sampler2D)
 0:47        'ga' (highp int)
-0:48      indirect index (uniform highp float)
+0:48      indirect index (highp float)
 0:48        'fua' (uniform 10-element array of highp float)
 0:48        'ga' (highp int)
-0:49      indirect index (in highp 3-component vector of float)
+0:49      indirect index (highp 3-component vector of float)
 0:49        'am3' (in highp 3X3 matrix of float)
 0:49        'ga' (highp int)
-0:50      indirect index (in highp float)
+0:50      indirect index (highp float)
 0:50        'av2' (in highp 2-component vector of float)
 0:50        'ga' (highp int)
-0:51      indirect index (smooth out highp 4-component vector of float)
+0:51      indirect index (smooth highp 4-component vector of float)
 0:51        'va' (smooth out 4-element array of highp 4-component vector of float)
 0:51        add (highp int)
 0:51          Constant:
 0:51            2 (const int)
 0:51          'ga' (highp int)
-0:52      indirect index (const highp 2-component vector of float)
+0:52      indirect index (highp 2-component vector of float)
 0:52        Constant:
 0:52          1.000000
 0:52          0.000000
 0:52          0.000000
 0:52          1.000000
 0:52        'ga' (highp int)
-0:53      indirect index (const highp float)
+0:53      indirect index (highp float)
 0:53        Constant:
 0:53          2.000000
 0:53          2.000000
@@ -339,34 +339,34 @@
 0:56              0 (const int)
 0:56          Loop Body
 0:57          Sequence
-0:57            indirect index (uniform lowp sampler2D)
+0:57            indirect index (lowp sampler2D)
 0:57              'fsa' (uniform 3-element array of lowp sampler2D)
 0:57              'a' (highp int)
-0:58            indirect index (uniform highp float)
+0:58            indirect index (highp float)
 0:58              'fua' (uniform 10-element array of highp float)
 0:58              add (highp int)
 0:58                'a' (highp int)
 0:58                Constant:
 0:58                  2 (const int)
-0:59            indirect index (in highp 3-component vector of float)
+0:59            indirect index (highp 3-component vector of float)
 0:59              'am3' (in highp 3X3 matrix of float)
 0:59              component-wise multiply (highp int)
 0:59                Constant:
 0:59                  3 (const int)
 0:59                'a' (highp int)
-0:60            indirect index (in highp float)
+0:60            indirect index (highp float)
 0:60              'av2' (in highp 2-component vector of float)
 0:60              component-wise multiply (highp int)
 0:60                Constant:
 0:60                  3 (const int)
 0:60                'a' (highp int)
-0:61            indirect index (smooth out highp 4-component vector of float)
+0:61            indirect index (smooth highp 4-component vector of float)
 0:61              'va' (smooth out 4-element array of highp 4-component vector of float)
 0:61              subtract (highp int)
 0:61                'a' (highp int)
 0:61                Constant:
 0:61                  1 (const int)
-0:62            indirect index (const highp 2-component vector of float)
+0:62            indirect index (highp 2-component vector of float)
 0:62              Constant:
 0:62                1.000000
 0:62                0.000000
@@ -376,7 +376,7 @@
 0:62                'a' (highp int)
 0:62                Constant:
 0:62                  2 (const int)
-0:63            indirect index (const highp float)
+0:63            indirect index (highp float)
 0:63              Constant:
 0:63                2.000000
 0:63                2.000000
@@ -391,23 +391,23 @@
 0:56          Loop Terminal Expression
 0:56          Post-Decrement (highp int)
 0:56            'a' (highp int)
-0:68      direct index (uniform lowp sampler2D)
+0:68      direct index (lowp sampler2D)
 0:68        'fsa' (uniform 3-element array of lowp sampler2D)
 0:68        Constant:
 0:68          2 (const int)
-0:69      direct index (uniform highp float)
+0:69      direct index (highp float)
 0:69        'fua' (uniform 10-element array of highp float)
 0:69        Constant:
 0:69          3 (const int)
-0:70      direct index (in highp 3-component vector of float)
+0:70      direct index (highp 3-component vector of float)
 0:70        'am3' (in highp 3X3 matrix of float)
 0:70        Constant:
 0:70          2 (const int)
-0:71      direct index (in highp float)
+0:71      direct index (highp float)
 0:71        'av2' (in highp 2-component vector of float)
 0:71        Constant:
 0:71          1 (const int)
-0:72      direct index (smooth out highp 4-component vector of float)
+0:72      direct index (smooth highp 4-component vector of float)
 0:72        'va' (smooth out 4-element array of highp 4-component vector of float)
 0:72        Constant:
 0:72          1 (const int)
diff --git a/Test/baseResults/120.frag.out b/Test/baseResults/120.frag.out
index 5691aec8a..a550fee2e 100644
--- a/Test/baseResults/120.frag.out
+++ b/Test/baseResults/120.frag.out
@@ -262,7 +262,7 @@ ERROR: node is still EOpNull!
 0:105        logical-and (bool)
 0:105          Compare Less Than (bool)
 0:105            Absolute value (float)
-0:105              direct index (in float)
+0:105              direct index (float)
 0:105                'v' (in 3-component vector of float)
 0:105                Constant:
 0:105                  0 (const int)
@@ -270,7 +270,7 @@ ERROR: node is still EOpNull!
 0:105              0.000100
 0:105          Compare Less Than (bool)
 0:105            Absolute value (float)
-0:105              direct index (in float)
+0:105              direct index (float)
 0:105                'v' (in 3-component vector of float)
 0:105                Constant:
 0:105                  1 (const int)
@@ -293,13 +293,13 @@ ERROR: node is still EOpNull!
 0:120      Sequence
 0:120        move second child to first child (4-component vector of float)
 0:120          'v' (4-component vector of float)
-0:120          direct index (smooth in 4-component vector of float)
+0:120          direct index (smooth 4-component vector of float)
 0:120            'gl_TexCoord' (smooth in unsized array of 4-component vector of float)
 0:120            Constant:
 0:120              1 (const int)
 0:121      add second child into first child (4-component vector of float)
 0:121        'v' (4-component vector of float)
-0:121        direct index (smooth in 4-component vector of float)
+0:121        direct index (smooth 4-component vector of float)
 0:121          'gl_TexCoord' (smooth in 6-element array of 4-component vector of float)
 0:121          Constant:
 0:121            3 (const int)
diff --git a/Test/baseResults/130.frag.out b/Test/baseResults/130.frag.out
index e26427567..f6120e9b4 100644
--- a/Test/baseResults/130.frag.out
+++ b/Test/baseResults/130.frag.out
@@ -9,7 +9,7 @@ ERROR: node is still EOpNull!
 0:18      Sequence
 0:18        move second child to first child (float)
 0:18          'clip' (float)
-0:18          direct index (smooth in float)
+0:18          direct index (smooth float)
 0:18            'gl_ClipDistance' (smooth in unsized array of float)
 0:18            Constant:
 0:18              3 (const int)
diff --git a/Test/baseResults/140.frag.out b/Test/baseResults/140.frag.out
index 1660a16c4..d548dd098 100644
--- a/Test/baseResults/140.frag.out
+++ b/Test/baseResults/140.frag.out
@@ -10,7 +10,7 @@ ERROR: node is still EOpNull!
 0:12      Sequence
 0:12        move second child to first child (float)
 0:12          'clip' (float)
-0:12          direct index (smooth in float)
+0:12          direct index (smooth float)
 0:12            'gl_ClipDistance' (smooth in 5-element array of float)
 0:12            Constant:
 0:12              2 (const int)
diff --git a/Test/baseResults/150.geom.out b/Test/baseResults/150.geom.out
index 57bbecd19..186e4a492 100644
--- a/Test/baseResults/150.geom.out
+++ b/Test/baseResults/150.geom.out
@@ -62,7 +62,7 @@ ERROR: node is still EOpNull!
 0:33            3 (const int)
 0:33        direct index (float)
 0:33          gl_ClipDistance: direct index for structure (unsized array of float)
-0:33            direct index (in block{gl_Position,gl_PointSize,gl_ClipDistance})
+0:33            direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
 0:33              'gl_in' (in 4-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
 0:33              Constant:
 0:33                1 (const int)
@@ -76,7 +76,7 @@ ERROR: node is still EOpNull!
 0:34          Constant:
 0:34            0 (const uint)
 0:34        gl_Position: direct index for structure (4-component vector of float)
-0:34          direct index (in block{gl_Position,gl_PointSize,gl_ClipDistance})
+0:34          direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
 0:34            'gl_in' (in 4-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
 0:34            Constant:
 0:34              0 (const int)
@@ -88,7 +88,7 @@ ERROR: node is still EOpNull!
 0:35          Constant:
 0:35            1 (const uint)
 0:35        gl_PointSize: direct index for structure (float)
-0:35          direct index (in block{gl_Position,gl_PointSize,gl_ClipDistance})
+0:35          direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
 0:35            'gl_in' (in 4-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
 0:35            Constant:
 0:35              3 (const int)
diff --git a/Test/baseResults/300.frag.out b/Test/baseResults/300.frag.out
index 6c08d7431..670ce24da 100644
--- a/Test/baseResults/300.frag.out
+++ b/Test/baseResults/300.frag.out
@@ -58,7 +58,7 @@ ERROR: node is still EOpNull!
 0:62      move second child to first child (lowp 4-component vector of float)
 0:62        'v' (lowp 4-component vector of float)
 0:62        Function Call: texelFetchOffset(s21;vi2;i1;vi2; (lowp 4-component vector of float)
-0:62          direct index (uniform lowp sampler2D)
+0:62          direct index (lowp sampler2D)
 0:62            'arrayedSampler' (uniform 5-element array of lowp sampler2D)
 0:62            Constant:
 0:62              2 (const int)
@@ -113,7 +113,7 @@ ERROR: node is still EOpNull!
 0:69      move second child to first child (lowp 4-component vector of float)
 0:69        'v' (lowp 4-component vector of float)
 0:69        Function Call: texture(s21;vf2; (lowp 4-component vector of float)
-0:69          indirect index (uniform lowp sampler2D)
+0:69          indirect index (lowp sampler2D)
 0:69            'arrayedSampler' (uniform 5-element array of lowp sampler2D)
 0:69            'ic1D' (flat in mediump int)
 0:69          'c2D' (smooth in lowp 2-component vector of float)
diff --git a/Test/baseResults/300.vert.out b/Test/baseResults/300.vert.out
index 934b6cd6e..38826088c 100644
--- a/Test/baseResults/300.vert.out
+++ b/Test/baseResults/300.vert.out
@@ -108,7 +108,7 @@ ERROR: node is still EOpNull!
 0:47            'v3' (in highp 3-component vector of float)
 0:49      move second child to first child (highp 4-component vector of float)
 0:49        'gl_Position' (gl_Position highp 4-component vector of float)
-0:49        direct index (uniform highp 4-component vector of float)
+0:49        direct index (highp 4-component vector of float)
 0:49          'm44' (uniform highp 4X4 matrix of float)
 0:49          Constant:
 0:49            2 (const int)
diff --git a/Test/baseResults/300block.frag.out b/Test/baseResults/300block.frag.out
index a64693b2b..6f2e670fc 100644
--- a/Test/baseResults/300block.frag.out
+++ b/Test/baseResults/300block.frag.out
@@ -30,7 +30,7 @@ ERROR: node is still EOpNull!
 0:44          Convert uint to float (float)
 0:44            direct index (mediump uint)
 0:44              nbv: direct index for structure (layout(column_major shared ) mediump 4-component vector of uint)
-0:44                direct index (layout(column_major shared ) uniform block{nbv,ni})
+0:44                direct index (layout(column_major shared ) block{nbv,ni})
 0:44                  'insts' (layout(column_major shared ) uniform 4-element array of block{nbv,ni})
 0:44                  Constant:
 0:44                    2 (const int)
@@ -38,7 +38,7 @@ ERROR: node is still EOpNull!
 0:44                  0 (const int)
 0:44              Constant:
 0:44                2 (const int)
-0:45      indirect index (layout(column_major shared ) uniform block{nbv,ni})
+0:45      indirect index (layout(column_major shared ) block{nbv,ni})
 0:45        'insts' (layout(column_major shared ) uniform 4-element array of block{nbv,ni})
 0:45        direct index (mediump uint)
 0:45          v: direct index for structure (mediump 4-component vector of uint)
diff --git a/Test/baseResults/300layout.frag.out b/Test/baseResults/300layout.frag.out
index 814e3d12c..2992d2e29 100644
--- a/Test/baseResults/300layout.frag.out
+++ b/Test/baseResults/300layout.frag.out
@@ -12,7 +12,7 @@ ERROR: node is still EOpNull!
 0:13        'p' (layout(location=3 ) out mediump 4-component vector of float)
 0:13        'pos' (smooth in mediump 4-component vector of float)
 0:14      move second child to first child (mediump 4-component vector of float)
-0:14        direct index (layout(location=4 ) out mediump 4-component vector of float)
+0:14        direct index (layout(location=4 ) mediump 4-component vector of float)
 0:14          'q' (layout(location=4 ) out 2-element array of mediump 4-component vector of float)
 0:14          Constant:
 0:14            1 (const int)
diff --git a/Test/baseResults/330.frag.out b/Test/baseResults/330.frag.out
index 435cc0836..6de5fef59 100644
--- a/Test/baseResults/330.frag.out
+++ b/Test/baseResults/330.frag.out
@@ -7,7 +7,7 @@ Warning, version 330 is not yet complete; some version-specific features are pre
 0:10        'gl_FragColor' (fragColor 4-component vector of float)
 0:10        'varyingVar' (smooth in 4-component vector of float)
 0:11      move second child to first child (4-component vector of float)
-0:11        direct index (fragColor 4-component vector of float)
+0:11        direct index (4-component vector of float)
 0:11          'gl_FragData' (fragColor 32-element array of 4-component vector of float)
 0:11          Constant:
 0:11            1 (const int)
diff --git a/Test/baseResults/330comp.frag.out b/Test/baseResults/330comp.frag.out
index d9c163c9e..dfe8dc74e 100644
--- a/Test/baseResults/330comp.frag.out
+++ b/Test/baseResults/330comp.frag.out
@@ -7,7 +7,7 @@ Warning, version 330 is not yet complete; some version-specific features are pre
 0:10        'gl_FragColor' (fragColor 4-component vector of float)
 0:10        'varyingVar' (smooth in 4-component vector of float)
 0:11      move second child to first child (4-component vector of float)
-0:11        direct index (fragColor 4-component vector of float)
+0:11        direct index (4-component vector of float)
 0:11          'gl_FragData' (fragColor 32-element array of 4-component vector of float)
 0:11          Constant:
 0:11            1 (const int)
diff --git a/Test/baseResults/400.frag.out b/Test/baseResults/400.frag.out
index 2a1b41866..89396d272 100644
--- a/Test/baseResults/400.frag.out
+++ b/Test/baseResults/400.frag.out
@@ -12,7 +12,7 @@ ERROR: node is still EOpNull!
 0:13      move second child to first child (4-component vector of float)
 0:13        'v' (4-component vector of float)
 0:13        Function Call: texture(s21;vf2; (4-component vector of float)
-0:13          indirect index (uniform sampler2D)
+0:13          indirect index (sampler2D)
 0:13            'arrayedSampler' (uniform 5-element array of sampler2D)
 0:13            'i' (flat in int)
 0:13          'c2D' (smooth in 2-component vector of float)
@@ -21,7 +21,7 @@ ERROR: node is still EOpNull!
 0:14          'outp' (out 4-component vector of float)
 0:14          Constant:
 0:14            0 (const int)
-0:14        direct index (smooth in float)
+0:14        direct index (smooth float)
 0:14          'gl_ClipDistance' (smooth in unsized array of float)
 0:14          Constant:
 0:14            1 (const int)
@@ -38,7 +38,7 @@ ERROR: node is still EOpNull!
 0:18        move second child to first child (4-component vector of float)
 0:18          'v4' (4-component vector of float)
 0:18          Function Call: textureGather(s21;vf2; (4-component vector of float)
-0:18            direct index (uniform sampler2D)
+0:18            direct index (sampler2D)
 0:18              'arrayedSampler' (uniform 5-element array of sampler2D)
 0:18              Constant:
 0:18                0 (const int)
diff --git a/Test/baseResults/400.geom.out b/Test/baseResults/400.geom.out
index 2bbac98d2..9bef66271 100644
--- a/Test/baseResults/400.geom.out
+++ b/Test/baseResults/400.geom.out
@@ -32,7 +32,7 @@ ERROR: node is still EOpNull!
 0:24      Constant:
 0:24        1 (const int)
 0:25      gl_Position: direct index for structure (4-component vector of float)
-0:25        direct index (in block{gl_Position})
+0:25        direct index (block{gl_Position})
 0:25          'gl_in' (in 3-element array of block{gl_Position})
 0:25          Constant:
 0:25            1 (const int)
diff --git a/Test/baseResults/410.geom.out b/Test/baseResults/410.geom.out
index a9a3c5efb..5a01691c7 100644
--- a/Test/baseResults/410.geom.out
+++ b/Test/baseResults/410.geom.out
@@ -25,7 +25,7 @@ ERROR: node is still EOpNull!
 0:30        move second child to first child (float)
 0:30          'p' (float)
 0:30          gl_PointSize: direct index for structure (float)
-0:30            direct index (in block{gl_PointSize})
+0:30            direct index (block{gl_PointSize})
 0:30              'gl_in' (in unsized array of block{gl_PointSize})
 0:30              Constant:
 0:30                1 (const int)
diff --git a/Test/baseResults/420.geom.out b/Test/baseResults/420.geom.out
index 1c2907f63..d06a7d6db 100644
--- a/Test/baseResults/420.geom.out
+++ b/Test/baseResults/420.geom.out
@@ -1,7 +1,9 @@
-Warning, version 150 is not yet complete; some version-specific features are present, but many are missing.
+Warning, version 420 is not yet complete; some version-specific features are present, but many are missing.
 ERROR: 0:9: 'length' :  array must be declared with a size before using this method
 ERROR: 0:11: '[' :  array must be redeclared with a size before being indexed with a variable
-ERROR: 2 compilation errors.  No code generated.
+ERROR: 0:42: 'assign' :  l-value required (can't modify a const)
+ERROR: 0:43: 'assign' :  l-value required "v4" (can't modify a uniform)
+ERROR: 4 compilation errors.  No code generated.
 
 invocations = 0
 max_vertices = 0
@@ -14,14 +16,14 @@ ERROR: node is still EOpNull!
 0:9      Constant:
 0:9        1 (const int)
 0:10      gl_Position: direct index for structure (4-component vector of float)
-0:10        direct index (in block{gl_Position,gl_PointSize,gl_ClipDistance})
+0:10        direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
 0:10          'gl_in' (in 3-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
 0:10          Constant:
 0:10            1 (const int)
 0:10        Constant:
 0:10          0 (const int)
 0:11      gl_Position: direct index for structure (4-component vector of float)
-0:11        indirect index (in block{gl_Position,gl_PointSize,gl_ClipDistance})
+0:11        indirect index (block{gl_Position,gl_PointSize,gl_ClipDistance})
 0:11          'gl_in' (in 3-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
 0:11          'i' (int)
 0:11        Constant:
@@ -32,15 +34,83 @@ ERROR: node is still EOpNull!
 0:20      Constant:
 0:20        3 (const int)
 0:21      gl_Position: direct index for structure (4-component vector of float)
-0:21        indirect index (in block{gl_Position,gl_PointSize,gl_ClipDistance})
+0:21        indirect index (block{gl_Position,gl_PointSize,gl_ClipDistance})
 0:21          'gl_in' (in 3-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
 0:21          'i' (int)
 0:21        Constant:
 0:21          0 (const int)
 0:22      Constant:
 0:22        3 (const int)
+0:29  Function Definition: foo4( (void)
+0:29    Function Parameters: 
+0:?     Sequence
+0:40      Sequence
+0:40        move second child to first child (4-component vector of float)
+0:40          'v' (4-component vector of float)
+0:40          Function Call: textureGatherOffset(s21;vf2;vi2; (4-component vector of float)
+0:40            's2D' (uniform sampler2D)
+0:40            'coord' (in 2-component vector of float)
+0:40            vector swizzle (2-component vector of int)
+0:40              indirect index (2-component vector of int)
+0:40                Constant:
+0:40                  0 (const int)
+0:40                  1 (const int)
+0:40                  1 (const int)
+0:40                  -2 (const int)
+0:40                  0 (const int)
+0:40                  3 (const int)
+0:40                  -3 (const int)
+0:40                  0 (const int)
+0:40                  2 (const int)
+0:40                  1 (const int)
+0:40                'i' (int)
+0:40              Sequence
+0:40                Constant:
+0:40                  0 (const int)
+0:40                Constant:
+0:40                  1 (const int)
+0:42      move second child to first child (2-component vector of int)
+0:42        vector swizzle (2-component vector of int)
+0:42          indirect index (2-component vector of int)
+0:42            Constant:
+0:42              0 (const int)
+0:42              1 (const int)
+0:42              1 (const int)
+0:42              -2 (const int)
+0:42              0 (const int)
+0:42              3 (const int)
+0:42              -3 (const int)
+0:42              0 (const int)
+0:42              2 (const int)
+0:42              1 (const int)
+0:42            'i' (int)
+0:42          Sequence
+0:42            Constant:
+0:42              0 (const int)
+0:42            Constant:
+0:42              1 (const int)
+0:42        Constant:
+0:42          3 (const int)
+0:42          3 (const int)
+0:43      move second child to first child (float)
+0:43        direct index (float)
+0:43          'v4' (uniform 4-component vector of float)
+0:43          Constant:
+0:43            0 (const int)
+0:43        Constant:
+0:43          3.200000
+0:44      vector swizzle (2-component vector of float)
+0:44        'v4' (uniform 4-component vector of float)
+0:44        Sequence
+0:44          Constant:
+0:44            0 (const int)
+0:44          Constant:
+0:44            1 (const int)
 0:?   Linker Objects
 0:?     'i' (int)
 0:?     'gl_in' (in 3-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
 0:?     'color3' (in 3-element array of 4-component vector of float)
+0:?     's2D' (uniform sampler2D)
+0:?     'coord' (in 2-component vector of float)
+0:?     'v4' (uniform 4-component vector of float)
 
diff --git a/Test/baseResults/420.vert.out b/Test/baseResults/420.vert.out
index e76430e27..7af5abb72 100644
--- a/Test/baseResults/420.vert.out
+++ b/Test/baseResults/420.vert.out
@@ -69,7 +69,7 @@ ERROR: node is still EOpNull!
 0:55        Condition
 0:55        Compare Equal (bool)
 0:55          direct index (float)
-0:55            direct index (in 4-component vector of float)
+0:55            direct index (4-component vector of float)
 0:55              'bad' (in 10-element array of 4-component vector of float)
 0:55              Constant:
 0:55                0 (const int)
@@ -85,7 +85,7 @@ ERROR: node is still EOpNull!
 0:57        true case
 0:58        move second child to first child (4-component vector of float)
 0:58          'badorder3' (flat out 4-component vector of float)
-0:58          direct index (in 4-component vector of float)
+0:58          direct index (4-component vector of float)
 0:58            'bad' (in 10-element array of 4-component vector of float)
 0:58            Constant:
 0:58              0 (const int)
diff --git a/Test/baseResults/array.frag.out b/Test/baseResults/array.frag.out
index 364018440..dd3fab12e 100644
--- a/Test/baseResults/array.frag.out
+++ b/Test/baseResults/array.frag.out
@@ -22,19 +22,19 @@ ERROR: node is still EOpNull!
 0:11    Sequence
 0:11      Branch: Return with expression
 0:11        Construct float (4-element array of float)
-0:11          direct index (in float)
+0:11          direct index (float)
 0:11            'a' (in 5-element array of float)
 0:11            Constant:
 0:11              0 (const int)
-0:11          direct index (in float)
+0:11          direct index (float)
 0:11            'a' (in 5-element array of float)
 0:11            Constant:
 0:11              1 (const int)
-0:11          direct index (in float)
+0:11          direct index (float)
 0:11            'a' (in 5-element array of float)
 0:11            Constant:
 0:11              2 (const int)
-0:11          direct index (in float)
+0:11          direct index (float)
 0:11            'a' (in 5-element array of float)
 0:11            Constant:
 0:11              3 (const int)
@@ -116,7 +116,7 @@ ERROR: node is still EOpNull!
 0:43      Function Call: foo(f1[5]; (4-element array of float)
 0:43        'u' (5-element array of float)
 0:45      move second child to first child (4-component vector of float)
-0:45        direct index (fragColor 4-component vector of float)
+0:45        direct index (4-component vector of float)
 0:45          'gl_FragData' (fragColor 32-element array of 4-component vector of float)
 0:45          Constant:
 0:45            1000 (const int)
@@ -126,7 +126,7 @@ ERROR: node is still EOpNull!
 0:45          1.000000
 0:45          1.000000
 0:46      move second child to first child (4-component vector of float)
-0:46        direct index (fragColor 4-component vector of float)
+0:46        direct index (4-component vector of float)
 0:46          'gl_FragData' (fragColor 32-element array of 4-component vector of float)
 0:46          Constant:
 0:46            -1 (const int)
@@ -136,7 +136,7 @@ ERROR: node is still EOpNull!
 0:46          1.000000
 0:46          1.000000
 0:47      move second child to first child (4-component vector of float)
-0:47        direct index (fragColor 4-component vector of float)
+0:47        direct index (4-component vector of float)
 0:47          'gl_FragData' (fragColor 32-element array of 4-component vector of float)
 0:47          Constant:
 0:47            3 (const int)
diff --git a/Test/baseResults/array100.frag.out b/Test/baseResults/array100.frag.out
index ce9072b7f..400b097e3 100644
--- a/Test/baseResults/array100.frag.out
+++ b/Test/baseResults/array100.frag.out
@@ -24,19 +24,19 @@ ERROR: node is still EOpNull!
 0:11    Sequence
 0:11      Branch: Return with expression
 0:11        Construct float (4-element array of float)
-0:11          direct index (in mediump float)
+0:11          direct index (mediump float)
 0:11            'a' (in 5-element array of mediump float)
 0:11            Constant:
 0:11              0 (const int)
-0:11          direct index (in mediump float)
+0:11          direct index (mediump float)
 0:11            'a' (in 5-element array of mediump float)
 0:11            Constant:
 0:11              1 (const int)
-0:11          direct index (in mediump float)
+0:11          direct index (mediump float)
 0:11            'a' (in 5-element array of mediump float)
 0:11            Constant:
 0:11              2 (const int)
-0:11          direct index (in mediump float)
+0:11          direct index (mediump float)
 0:11            'a' (in 5-element array of mediump float)
 0:11            Constant:
 0:11              3 (const int)
@@ -91,7 +91,7 @@ ERROR: node is still EOpNull!
 0:36      Function Call: foo(f1[5]; (4-element array of mediump float)
 0:36        'u' (5-element array of mediump float)
 0:38      move second child to first child (mediump 4-component vector of float)
-0:38        direct index (fragColor mediump 4-component vector of float)
+0:38        direct index (mediump 4-component vector of float)
 0:38          'gl_FragData' (fragColor 32-element array of mediump 4-component vector of float)
 0:38          Constant:
 0:38            1000 (const int)
@@ -101,7 +101,7 @@ ERROR: node is still EOpNull!
 0:38          1.000000
 0:38          1.000000
 0:39      move second child to first child (mediump 4-component vector of float)
-0:39        direct index (fragColor mediump 4-component vector of float)
+0:39        direct index (mediump 4-component vector of float)
 0:39          'gl_FragData' (fragColor 32-element array of mediump 4-component vector of float)
 0:39          Constant:
 0:39            -1 (const int)
@@ -111,7 +111,7 @@ ERROR: node is still EOpNull!
 0:39          1.000000
 0:39          1.000000
 0:40      move second child to first child (mediump 4-component vector of float)
-0:40        direct index (fragColor mediump 4-component vector of float)
+0:40        direct index (mediump 4-component vector of float)
 0:40          'gl_FragData' (fragColor 32-element array of mediump 4-component vector of float)
 0:40          Constant:
 0:40            3 (const int)
diff --git a/Test/baseResults/dataOut.frag.out b/Test/baseResults/dataOut.frag.out
index a57aec36f..dbceed656 100644
--- a/Test/baseResults/dataOut.frag.out
+++ b/Test/baseResults/dataOut.frag.out
@@ -5,7 +5,7 @@ WARNING: 0:3: varying deprecated in version 130; may be removed in future releas
 0:5    Function Parameters: 
 0:7    Sequence
 0:7      move second child to first child (4-component vector of float)
-0:7        direct index (fragColor 4-component vector of float)
+0:7        direct index (4-component vector of float)
 0:7          'gl_FragData' (fragColor 32-element array of 4-component vector of float)
 0:7          Constant:
 0:7            1 (const int)
diff --git a/Test/baseResults/dataOutIndirect.frag.out b/Test/baseResults/dataOutIndirect.frag.out
index 5e18a6a60..b6e1c09bf 100644
--- a/Test/baseResults/dataOutIndirect.frag.out
+++ b/Test/baseResults/dataOutIndirect.frag.out
@@ -5,7 +5,7 @@ WARNING: 0:3: varying deprecated in version 130; may be removed in future releas
 0:7    Function Parameters: 
 0:9    Sequence
 0:9      move second child to first child (4-component vector of float)
-0:9        indirect index (fragColor 4-component vector of float)
+0:9        indirect index (4-component vector of float)
 0:9          'gl_FragData' (fragColor 32-element array of 4-component vector of float)
 0:9          'i' (uniform int)
 0:9        'Color' (smooth in 4-component vector of float)
diff --git a/Test/baseResults/length.frag.out b/Test/baseResults/length.frag.out
index c4438c554..b51af1706 100644
--- a/Test/baseResults/length.frag.out
+++ b/Test/baseResults/length.frag.out
@@ -7,11 +7,11 @@ Warning, version 120 is not yet complete; most features are present, but a few a
 0:15        move second child to first child (2-component vector of float)
 0:15          't' (2-component vector of float)
 0:15          add (2-component vector of float)
-0:15            direct index (smooth in 2-component vector of float)
+0:15            direct index (smooth 2-component vector of float)
 0:15              'v' (smooth in 2-element array of 2-component vector of float)
 0:15              Constant:
 0:15                0 (const int)
-0:15            direct index (smooth in 2-component vector of float)
+0:15            direct index (smooth 2-component vector of float)
 0:15              'v' (smooth in 2-element array of 2-component vector of float)
 0:15              Constant:
 0:15                1 (const int)
diff --git a/Test/baseResults/link1.frag.out b/Test/baseResults/link1.frag.out
index 6827be305..65c7fc6c1 100644
--- a/Test/baseResults/link1.frag.out
+++ b/Test/baseResults/link1.frag.out
@@ -24,7 +24,7 @@ Warning, version 130 is not yet complete; most features are present, but a few a
 0:21    Sequence
 0:21      Branch: Return with expression
 0:21        Convert float to int (2-component vector of int)
-0:21          direct index (in 2-component vector of float)
+0:21          direct index (2-component vector of float)
 0:21            'm' (in 2X2 matrix of float)
 0:21            Constant:
 0:21              0 (const int)
@@ -197,7 +197,7 @@ ERROR: Linking fragment stage: Precision qualifiers must match:
 0:21    Sequence
 0:21      Branch: Return with expression
 0:21        Convert float to int (2-component vector of int)
-0:21          direct index (in 2-component vector of float)
+0:21          direct index (2-component vector of float)
 0:21            'm' (in 2X2 matrix of float)
 0:21            Constant:
 0:21              0 (const int)
diff --git a/Test/baseResults/matrix.frag.out b/Test/baseResults/matrix.frag.out
index e3613eca7..2d794cf68 100644
--- a/Test/baseResults/matrix.frag.out
+++ b/Test/baseResults/matrix.frag.out
@@ -9,7 +9,7 @@ WARNING: 0:22: varying deprecated in version 130; may be removed in future relea
 0:27      move second child to first child (4-component vector of float)
 0:27        'gl_FragColor' (fragColor 4-component vector of float)
 0:27        Construct vec4 (4-component vector of float)
-0:27          direct index (uniform 4-component vector of float)
+0:27          direct index (4-component vector of float)
 0:27            'un34' (uniform 4X4 matrix of float)
 0:27            Constant:
 0:27              1 (const int)
diff --git a/Test/baseResults/structure.frag.out b/Test/baseResults/structure.frag.out
index 1c5f9fde1..53c7e96e9 100644
--- a/Test/baseResults/structure.frag.out
+++ b/Test/baseResults/structure.frag.out
@@ -14,7 +14,7 @@ WARNING: 0:3: varying deprecated in version 130; may be removed in future releas
 0:24        Compare Greater Than (bool)
 0:24          direct index (int)
 0:24            i: direct index for structure (5-element array of int)
-0:24              direct index (uniform structure{i,f,s1_1})
+0:24              direct index (structure{i,f,s1_1})
 0:24                'foo2' (uniform 5-element array of structure{i,f,s1_1})
 0:24                Constant:
 0:24                  3 (const int)
@@ -32,7 +32,7 @@ WARNING: 0:3: varying deprecated in version 130; may be removed in future releas
 0:25              color: direct index for structure (5-element array of 4-component vector of float)
 0:25                direct index (structure{i,f,color})
 0:25                  s1_1: direct index for structure (7-element array of structure{i,f,color})
-0:25                    direct index (uniform structure{i,f,s1_1})
+0:25                    direct index (structure{i,f,s1_1})
 0:25                      'foo2' (uniform 5-element array of structure{i,f,s1_1})
 0:25                      Constant:
 0:25                        3 (const int)
@@ -53,7 +53,7 @@ WARNING: 0:3: varying deprecated in version 130; may be removed in future releas
 0:27            f: direct index for structure (4-element array of float)
 0:27              direct index (structure{i,f,color})
 0:27                s1_1: direct index for structure (7-element array of structure{i,f,color})
-0:27                  direct index (uniform structure{i,f,s1_1})
+0:27                  direct index (structure{i,f,s1_1})
 0:27                    'foo2' (uniform 5-element array of structure{i,f,s1_1})
 0:27                    Constant:
 0:27                      3 (const int)
diff --git a/Test/baseResults/uniformArray.frag.out b/Test/baseResults/uniformArray.frag.out
index c71228da1..e455809ac 100644
--- a/Test/baseResults/uniformArray.frag.out
+++ b/Test/baseResults/uniformArray.frag.out
@@ -7,11 +7,11 @@ Warning, version 130 is not yet complete; most features are present, but a few a
 0:9        move second child to first child (4-component vector of float)
 0:9          'texColor' (4-component vector of float)
 0:9          add (4-component vector of float)
-0:9            direct index (uniform 4-component vector of float)
+0:9            direct index (4-component vector of float)
 0:9              'color' (uniform 6-element array of 4-component vector of float)
 0:9              Constant:
 0:9                1 (const int)
-0:9            direct index (uniform 4-component vector of float)
+0:9            direct index (4-component vector of float)
 0:9              'color' (uniform 6-element array of 4-component vector of float)
 0:9              Constant:
 0:9                1 (const int)
@@ -31,7 +31,7 @@ Warning, version 130 is not yet complete; most features are present, but a few a
 0:13          'texColor' (4-component vector of float)
 0:13          Constant:
 0:13            3 (const int)
-0:13        direct index (uniform float)
+0:13        direct index (float)
 0:13          'alpha' (uniform 16-element array of float)
 0:13          Constant:
 0:13            12 (const int)
diff --git a/Test/baseResults/variableArrayIndex.frag.out b/Test/baseResults/variableArrayIndex.frag.out
index 7f32727fb..e7d2d2a1a 100644
--- a/Test/baseResults/variableArrayIndex.frag.out
+++ b/Test/baseResults/variableArrayIndex.frag.out
@@ -28,7 +28,7 @@ WARNING: 0:3: varying deprecated in version 130; may be removed in future releas
 0:35          'scale' (float)
 0:35          f: direct index for structure (float)
 0:35            s1_1: direct index for structure (structure{i,f})
-0:35              indirect index (uniform structure{i,f,s1_1})
+0:35              indirect index (structure{i,f,s1_1})
 0:35                'foo2' (uniform 5-element array of structure{i,f,s1_1})
 0:35                add (int)
 0:35                  add (int)
diff --git a/Test/baseResults/varyingArray.frag.out b/Test/baseResults/varyingArray.frag.out
index d8d0cdca3..8ea2a0189 100644
--- a/Test/baseResults/varyingArray.frag.out
+++ b/Test/baseResults/varyingArray.frag.out
@@ -14,11 +14,11 @@ WARNING: 0:8: varying deprecated in version 130; may be removed in future releas
 0:12            'texSampler2D' (uniform sampler2D)
 0:12            Construct vec2 (2-component vector of float)
 0:12              add (4-component vector of float)
-0:12                direct index (smooth in 4-component vector of float)
+0:12                direct index (smooth 4-component vector of float)
 0:12                  'gl_TexCoord' (smooth in 6-element array of 4-component vector of float)
 0:12                  Constant:
 0:12                    4 (const int)
-0:12                direct index (smooth in 4-component vector of float)
+0:12                direct index (smooth 4-component vector of float)
 0:12                  'gl_TexCoord' (smooth in 6-element array of 4-component vector of float)
 0:12                  Constant:
 0:12                    5 (const int)
@@ -36,15 +36,15 @@ WARNING: 0:8: varying deprecated in version 130; may be removed in future releas
 0:18        add (4-component vector of float)
 0:18          add (4-component vector of float)
 0:18            add (4-component vector of float)
-0:18              direct index (smooth in 4-component vector of float)
+0:18              direct index (smooth 4-component vector of float)
 0:18                'foo' (smooth in 3-element array of 4-component vector of float)
 0:18                Constant:
 0:18                  1 (const int)
-0:18              direct index (smooth in 4-component vector of float)
+0:18              direct index (smooth 4-component vector of float)
 0:18                'gl_TexCoord' (smooth in 6-element array of 4-component vector of float)
 0:18                Constant:
 0:18                  0 (const int)
-0:18            direct index (smooth in 4-component vector of float)
+0:18            direct index (smooth 4-component vector of float)
 0:18              'gl_TexCoord' (smooth in 6-element array of 4-component vector of float)
 0:18              Constant:
 0:18                4 (const int)
diff --git a/Test/baseResults/varyingArrayIndirect.frag.out b/Test/baseResults/varyingArrayIndirect.frag.out
index 311638f67..087c6a590 100644
--- a/Test/baseResults/varyingArrayIndirect.frag.out
+++ b/Test/baseResults/varyingArrayIndirect.frag.out
@@ -15,13 +15,13 @@ WARNING: 0:8: varying deprecated in version 130; may be removed in future releas
 0:14            Construct vec2 (2-component vector of float)
 0:14              add (4-component vector of float)
 0:14                add (4-component vector of float)
-0:14                  indirect index (smooth in 4-component vector of float)
+0:14                  indirect index (smooth 4-component vector of float)
 0:14                    'userIn' (smooth in 2-element array of 4-component vector of float)
 0:14                    'b' (uniform int)
-0:14                  indirect index (smooth in 4-component vector of float)
+0:14                  indirect index (smooth 4-component vector of float)
 0:14                    'gl_TexCoord' (smooth in 6-element array of 4-component vector of float)
 0:14                    'a' (uniform int)
-0:14                direct index (smooth in 4-component vector of float)
+0:14                direct index (smooth 4-component vector of float)
 0:14                  'gl_TexCoord' (smooth in 6-element array of 4-component vector of float)
 0:14                  Constant:
 0:14                    5 (const int)
@@ -39,15 +39,15 @@ WARNING: 0:8: varying deprecated in version 130; may be removed in future releas
 0:20        add (4-component vector of float)
 0:20          add (4-component vector of float)
 0:20            add (4-component vector of float)
-0:20              direct index (smooth in 4-component vector of float)
+0:20              direct index (smooth 4-component vector of float)
 0:20                'gl_TexCoord' (smooth in 6-element array of 4-component vector of float)
 0:20                Constant:
 0:20                  0 (const int)
-0:20              indirect index (smooth in 4-component vector of float)
+0:20              indirect index (smooth 4-component vector of float)
 0:20                'gl_TexCoord' (smooth in 6-element array of 4-component vector of float)
 0:20                'b' (uniform int)
 0:20            'texColor' (4-component vector of float)
-0:20          indirect index (smooth in 4-component vector of float)
+0:20          indirect index (smooth 4-component vector of float)
 0:20            'userIn' (smooth in 2-element array of 4-component vector of float)
 0:20            'a' (uniform int)
 0:?   Linker Objects
diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp
index 77100a86f..14c92a5f8 100644
--- a/glslang/MachineIndependent/ParseHelper.cpp
+++ b/glslang/MachineIndependent/ParseHelper.cpp
@@ -492,6 +492,8 @@ TIntermTyped* TParseContext::handleBracketDereference(TSourceLoc loc, TIntermTyp
         newType.shallowCopy(base->getType());
         if (base->getType().getQualifier().storage == EvqConst && index->getQualifier().storage == EvqConst)
             newType.getQualifier().storage = EvqConst;
+        else
+            newType.getQualifier().storage = EvqTemporary;
         newType.dereference();
         result->setType(newType);
 
@@ -3383,8 +3385,10 @@ TIntermNode* TParseContext::addSwitch(TSourceLoc loc, TIntermTyped* expression,
     return switchNode;
 }
 
+// TODO: constant folding: these should use a follow a fully folded model now, and probably move to Constant.cpp scheme.
+
 //
-// This function returns the tree representation for the vector field(s) being accessed from contant vector.
+// This function returns the tree representation for the vector field(s) being accessed from a constant vector.
 // If only one component of vector is accessed (v.x or v[0] where v is a contant vector), then a contant node is
 // returned, else an aggregate node is returned (for v.xy). The input to this function could either be the symbol
 // node or it could be the intermediate tree representation of accessing fields in a constant structure or column of
-- 
GitLab