From c5f2ab965fc2ec5873840f85ae574c6e6c3ce59d Mon Sep 17 00:00:00 2001
From: John Kessenich <cepheus@frii.com>
Date: Thu, 8 Jun 2017 10:07:14 -0600
Subject: [PATCH] GLSL: Disallow unsized arrays of atomic_uint.

This tracks Khronos-private specification bug 15945.
---
 Test/baseResults/420.frag.out              | 4 ++--
 glslang/MachineIndependent/ParseHelper.cpp | 8 ++------
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/Test/baseResults/420.frag.out b/Test/baseResults/420.frag.out
index 699c0c590..5f2b0f7b0 100644
--- a/Test/baseResults/420.frag.out
+++ b/Test/baseResults/420.frag.out
@@ -2,8 +2,8 @@
 ERROR: 0:4: 'redeclaration' : all redeclarations must use the same depth layout on gl_FragDepth
 ERROR: 0:11: 'layout qualifier' : can only apply depth layout to gl_FragDepth 
 ERROR: 0:12: 'gl_FragDepth' : cannot redeclare after use 
-WARNING: 0:14: 'atomic_uint' : implicitly sized atomic_uint array treated as having one element for tracking the default offset 
-ERROR: 3 compilation errors.  No code generated.
+ERROR: 0:14: 'atomic_uint' : array must be explicitly sized 
+ERROR: 4 compilation errors.  No code generated.
 
 
 Shader version: 420
diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp
index 31a06860e..431b445c9 100644
--- a/glslang/MachineIndependent/ParseHelper.cpp
+++ b/glslang/MachineIndependent/ParseHelper.cpp
@@ -4794,12 +4794,8 @@ void TParseContext::fixOffset(const TSourceLoc& loc, TSymbol& symbol)
                 if (symbol.getType().isExplicitlySizedArray())
                     numOffsets *= symbol.getType().getCumulativeArraySize();
                 else {
-                    // TODO: functionality: implicitly-sized atomic_uint arrays.
-                    // We don't know the full size until later.  This might
-                    // be a specification problem, will report to Khronos.  For the
-                    // cases that is not true, the rest of the checking would need
-                    // to be done at link time instead of compile time.
-                    warn(loc, "implicitly sized atomic_uint array treated as having one element for tracking the default offset", "atomic_uint", "");
+                    // "It is a compile-time error to declare an unsized array of atomic_uint."
+                    error(loc, "array must be explicitly sized", "atomic_uint", "");
                 }
             }
             int repeated = intermediate.addUsedOffsets(qualifier.layoutBinding, offset, numOffsets);
-- 
GitLab