Work around a GCC miscompilation issue.

Bug 18470793

Change-Id: Idac85c738810db112e7af56f5e1635c2ac6d325c
Reviewed-on: https://swiftshader-review.googlesource.com/1841
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/Shader/SetupRoutine.cpp b/src/Shader/SetupRoutine.cpp
index 84c33d5..fcb1284 100644
--- a/src/Shader/SetupRoutine.cpp
+++ b/src/Shader/SetupRoutine.cpp
@@ -451,23 +451,26 @@
 				*Pointer<Float4>(primitive + OFFSET(Primitive,z.C), 16) = C;
 			}
 
-			for(int interpolant = 0; interpolant < 11; interpolant++)
+			for(int interpolant = 0; interpolant < 10; interpolant++)
 			{
-				int componentCount = interpolant < 10 ? 4 : 1;   // Fog only has one component
-
-				for(int component = 0; component < componentCount; component++)
+				for(int component = 0; component < 4; component++)
 				{
 					int attribute = state.gradient[interpolant][component].attribute;
 					bool flat = state.gradient[interpolant][component].flat;
 					bool wrap = state.gradient[interpolant][component].wrap;
 
-					if(attribute < 12)
+					if(attribute != Unused)
 					{
 						setupGradient(primitive, tri, w012, M, v0, v1, v2, OFFSET(Vertex,v[attribute][component]), OFFSET(Primitive,V[interpolant][component]), flat, sprite, state.perspective, wrap, component);
 					}
 				}
 			}
 
+			if(state.fog.attribute == Fog)
+			{
+				setupGradient(primitive, tri, w012, M, v0, v1, v2, OFFSET(Vertex,f), OFFSET(Primitive,f), state.fog.flat, false, state.perspective, false, 0);
+			}
+
 			Return(true);
 		}