diff --git a/Test/baseResults/reflection.vert.out b/Test/baseResults/reflection.vert.out
index de49cc457e481877d9c1d6218a0f660ced01ed91..55e0844bc97a89822c26a10a67444c2451d15267 100644
--- a/Test/baseResults/reflection.vert.out
+++ b/Test/baseResults/reflection.vert.out
@@ -70,6 +70,9 @@ deepD[1].d2.d1[3].b: offset -1, type 8b56, size 1, index -1, binding -1
 deepD[1].v3: offset -1, type 8b54, size 1, index -1, binding -1
 abl.foo: offset 0, type 1406, size 1, index 7, binding -1
 abl2.foo: offset 0, type 1406, size 1, index 11, binding -1
+buf1.runtimeArray: offset 4, type 1406, size 4, index 12, binding -1
+buf2.runtimeArray.c: offset 8, type 1406, size 1, index 13, binding -1
+buf3.runtimeArray: offset 4, type 1406, size 0, index 14, binding -1
 anonMember1: offset 0, type 8b51, size 1, index 0, binding -1
 uf1: offset -1, type 1406, size 1, index -1, binding -1
 uf2: offset -1, type 1406, size 1, index -1, binding -1
@@ -88,6 +91,10 @@ abl2[0]: offset -1, type ffffffff, size 4, index -1, binding -1
 abl2[1]: offset -1, type ffffffff, size 4, index -1, binding -1
 abl2[2]: offset -1, type ffffffff, size 4, index -1, binding -1
 abl2[3]: offset -1, type ffffffff, size 4, index -1, binding -1
+buf1: offset -1, type ffffffff, size 4, index -1, binding -1
+buf2: offset -1, type ffffffff, size 4, index -1, binding -1
+buf3: offset -1, type ffffffff, size 4, index -1, binding -1
+buf4: offset -1, type ffffffff, size 4, index -1, binding -1
 
 Vertex attribute reflection:
 attributeFloat: offset 0, type 1406, size 0, index 0, binding -1
@@ -95,4 +102,5 @@ attributeFloat2: offset 0, type 8b50, size 0, index 0, binding -1
 attributeFloat3: offset 0, type 8b51, size 0, index 0, binding -1
 attributeFloat4: offset 0, type 8b52, size 0, index 0, binding -1
 attributeMat4: offset 0, type 8b5c, size 0, index 0, binding -1
+gl_InstanceID: offset 0, type 1404, size 0, index 0, binding -1
 
diff --git a/Test/reflection.vert b/Test/reflection.vert
index be49822523cf2773039ef2f904b761360a2889dc..7549f0816d73ca028a9a0deafe348754b53da8d6 100644
--- a/Test/reflection.vert
+++ b/Test/reflection.vert
@@ -133,6 +133,26 @@ uniform abl2 {
     float foo;
 } arrBl2[4];
 
+buffer buf1 {
+    float scalar;
+    float runtimeArray[];
+} buf1i;
+
+buffer buf2 {
+    float scalar;
+    N2 runtimeArray[];
+} buf2i;
+
+buffer buf3 {
+    float scalar;
+    float runtimeArray[];
+} buf3i;
+
+buffer buf4 {
+    float scalar;
+    N2 runtimeArray[];
+} buf4i;
+
 void main()
 {
     liveFunction1(image_ui2D, sampler_2D, sampler_2DMSArray);
@@ -179,4 +199,8 @@ void main()
     f += attributeFloat3.x;
     f += attributeFloat4.x;
     f += attributeMat4[0][1];
+    f += buf1i.runtimeArray[3];
+    f += buf2i.runtimeArray[3].c;
+    f += buf3i.runtimeArray[gl_InstanceID];
+    f += buf4i.runtimeArray[gl_InstanceID].c;
 }
diff --git a/glslang/MachineIndependent/reflection.cpp b/glslang/MachineIndependent/reflection.cpp
index aa132e7325bbea10fb96c837c803836ab42142ec..c3bdb7f4c775666a476da7dcc4229582c534f9e7 100644
--- a/glslang/MachineIndependent/reflection.cpp
+++ b/glslang/MachineIndependent/reflection.cpp
@@ -131,8 +131,11 @@ public:
         for (int m = 0; m <= index; ++m) {
             // modify just the children's view of matrix layout, if there is one for this member
             TLayoutMatrix subMatrixLayout = memberList[m].type->getQualifier().layoutMatrix;
-            int memberAlignment = intermediate.getBaseAlignment(*memberList[m].type, memberSize, dummyStride, type.getQualifier().layoutPacking == ElpStd140,
-                                                                subMatrixLayout != ElmNone ? subMatrixLayout == ElmRowMajor : type.getQualifier().layoutMatrix == ElmRowMajor);
+            int memberAlignment = intermediate.getBaseAlignment(*memberList[m].type, memberSize, dummyStride,
+                                                                type.getQualifier().layoutPacking == ElpStd140,
+                                                                subMatrixLayout != ElmNone
+                                                                    ? subMatrixLayout == ElmRowMajor
+                                                                    : type.getQualifier().layoutMatrix == ElmRowMajor);
             RoundToPow2(offset, memberAlignment);
             if (m < index)
                 offset += memberSize;
@@ -151,7 +154,8 @@ public:
 
         int lastMemberSize;
         int dummyStride;
-        intermediate.getBaseAlignment(*memberList[lastIndex].type, lastMemberSize, dummyStride, blockType.getQualifier().layoutPacking == ElpStd140,
+        intermediate.getBaseAlignment(*memberList[lastIndex].type, lastMemberSize, dummyStride,
+                                      blockType.getQualifier().layoutPacking == ElpStd140,
                                       blockType.getQualifier().layoutMatrix == ElmRowMajor);
 
         return lastOffset + lastMemberSize;
@@ -167,7 +171,7 @@ public:
     void blowUpActiveAggregate(const TType& baseType, const TString& baseName, const TList<TIntermBinary*>& derefs,
                                TList<TIntermBinary*>::const_iterator deref, int offset, int blockIndex, int arraySize)
     {
-        // process the part of the derefence chain that was explicit in the shader
+        // process the part of the dereference chain that was explicit in the shader
         TString name = baseName;
         const TType* terminalType = &baseType;
         for (; deref != derefs.end(); ++deref) {
@@ -235,7 +239,7 @@ public:
         }
 
         // Finally, add a full string to the reflection database, and update the array size if necessary.
-        // If the derefenced entity to record is an array, compute the size and update the maximum size.
+        // If the dereferenced entity to record is an array, compute the size and update the maximum size.
 
         // there might not be a final array dereference, it could have been copied as an array object
         if (arraySize == 0)
@@ -244,7 +248,8 @@ public:
         TReflection::TNameToIndex::const_iterator it = reflection.nameToIndex.find(name);
         if (it == reflection.nameToIndex.end()) {
             reflection.nameToIndex[name] = (int)reflection.indexToUniform.size();
-            reflection.indexToUniform.push_back(TObjectReflection(name, *terminalType, offset, mapToGlType(*terminalType),
+            reflection.indexToUniform.push_back(TObjectReflection(name, *terminalType, offset,
+                                                                  mapToGlType(*terminalType),
                                                                   arraySize, blockIndex));
         } else if (arraySize > 1) {
             int& reflectedArraySize = reflection.indexToUniform[it->second].size;
@@ -417,7 +422,8 @@ public:
                 case Esd2D:
                     switch ((int)sampler.ms) {
                     case false:  return sampler.arrayed ? GL_INT_SAMPLER_2D_ARRAY : GL_INT_SAMPLER_2D;
-                    case true:   return sampler.arrayed ? GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY : GL_INT_SAMPLER_2D_MULTISAMPLE;
+                    case true:   return sampler.arrayed ? GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY
+                                                        : GL_INT_SAMPLER_2D_MULTISAMPLE;
                     }
                 case Esd3D:
                     return GL_INT_SAMPLER_3D;
@@ -435,7 +441,8 @@ public:
                 case Esd2D:
                     switch ((int)sampler.ms) {
                     case false:  return sampler.arrayed ? GL_UNSIGNED_INT_SAMPLER_2D_ARRAY : GL_UNSIGNED_INT_SAMPLER_2D;
-                    case true:   return sampler.arrayed ? GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY : GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE;
+                    case true:   return sampler.arrayed ? GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY
+                                                        : GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE;
                     }
                 case Esd3D:
                     return GL_UNSIGNED_INT_SAMPLER_3D;
@@ -495,7 +502,8 @@ public:
                 case Esd2D:
                     switch ((int)sampler.ms) {
                     case false:  return sampler.arrayed ? GL_UNSIGNED_INT_IMAGE_2D_ARRAY : GL_UNSIGNED_INT_IMAGE_2D;
-                    case true:   return sampler.arrayed ? GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY : GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE;
+                    case true:   return sampler.arrayed ? GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY
+                                                        : GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE;
                     }
                 case Esd3D:
                     return GL_UNSIGNED_INT_IMAGE_3D;