Initialize array size on error.

The array size is set using the value returned by arraySizeErrorCheck,
even when an error occurred, so don't leave it uninitialized.

Bug chromium:801648

Change-Id: If2af27c5f61dca2931796f1681dce61ab6a44341
Reviewed-on: https://swiftshader-review.googlesource.com/18368
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/OpenGL/compiler/ParseHelper.cpp b/src/OpenGL/compiler/ParseHelper.cpp
index c7100ba..6d4b149 100644
--- a/src/OpenGL/compiler/ParseHelper.cpp
+++ b/src/OpenGL/compiler/ParseHelper.cpp
@@ -802,6 +802,7 @@
 	if (expr->getQualifier() != EvqConstExpr || constant == 0 || !constant->isScalarInt())
 	{
 		error(line, "array size must be a constant integer expression", "");
+		size = 1;
 		return true;
 	}
 
@@ -1485,7 +1486,7 @@
 
 	TType arrayType(publicType);
 
-	int size;
+	int size = 0;
 	if(arraySizeErrorCheck(identifierLocation, indexExpression, size))
 	{
 		recover();
@@ -1666,7 +1667,7 @@
 	else
 	{
 		TType arrayType = TType(publicType);
-		int size;
+		int size = 0;
 		if(arraySizeErrorCheck(arrayLocation, indexExpression, size))
 		{
 			recover();
diff --git a/src/OpenGL/compiler/glslang.y b/src/OpenGL/compiler/glslang.y
index cd0daff..f970d3b 100644
--- a/src/OpenGL/compiler/glslang.y
+++ b/src/OpenGL/compiler/glslang.y
@@ -728,7 +728,7 @@
         if (context->reservedErrorCheck(@2, *$2.string))
             context->recover();
 
-        int size;
+        int size = 0;
         if (context->arraySizeErrorCheck(@3, $4, size))
             context->recover();
         $1.setArray(true, size);
@@ -1069,7 +1069,7 @@
         if (context->arrayTypeErrorCheck(@2, $1))
             context->recover();
         else {
-            int size;
+            int size = 0;
             if (context->arraySizeErrorCheck(@2, $3, size))
                 context->recover();
             $$.setArray(true, size);
@@ -1385,7 +1385,7 @@
             context->recover();
 
         TType* type = new TType(EbtVoid, EbpUndefined);
-        int size;
+        int size = 0;
         if (context->arraySizeErrorCheck($3->getLine(), $3, size))
             context->recover();
         type->setArraySize(size);
diff --git a/src/OpenGL/compiler/glslang_tab.cpp b/src/OpenGL/compiler/glslang_tab.cpp
index 811da14..45d73fe 100644
--- a/src/OpenGL/compiler/glslang_tab.cpp
+++ b/src/OpenGL/compiler/glslang_tab.cpp
@@ -3249,7 +3249,7 @@
         if (context->reservedErrorCheck((yylsp[-3]), *(yyvsp[-3].lex).string))
             context->recover();
 
-        int size;
+        int size = 0;
         if (context->arraySizeErrorCheck((yylsp[-2]), (yyvsp[-1].interm.intermTypedNode), size))
             context->recover();
         (yyvsp[-4].interm.type).setArray(true, size);
@@ -3816,7 +3816,7 @@
         if (context->arrayTypeErrorCheck((yylsp[-2]), (yyvsp[-3].interm.type)))
             context->recover();
         else {
-            int size;
+            int size = 0;
             if (context->arraySizeErrorCheck((yylsp[-2]), (yyvsp[-1].interm.intermTypedNode), size))
                 context->recover();
             (yyval.interm.type).setArray(true, size);
@@ -4401,7 +4401,7 @@
             context->recover();
 
         TType* type = new TType(EbtVoid, EbpUndefined);
-        int size;
+        int size = 0;
         if (context->arraySizeErrorCheck((yyvsp[-1].interm.intermTypedNode)->getLine(), (yyvsp[-1].interm.intermTypedNode), size))
             context->recover();
         type->setArraySize(size);