diff --git a/Test/310implicitSizeArrayError.vert b/Test/310implicitSizeArrayError.vert new file mode 100644 index 00000000..72c403e8 --- /dev/null +++ b/Test/310implicitSizeArrayError.vert @@ -0,0 +1,8 @@ +#version 310 es +layout (location=0) uniform Block { + highp int a[]; +} uni; +layout (location=0) out highp int o; +void main() { + o = uni.a[2]; +} diff --git a/Test/baseResults/310implicitSizeArrayError.vert.out b/Test/baseResults/310implicitSizeArrayError.vert.out new file mode 100644 index 00000000..29fe7f5b --- /dev/null +++ b/Test/baseResults/310implicitSizeArrayError.vert.out @@ -0,0 +1,50 @@ +310implicitSizeArrayError.vert +Warning, version 310 is not yet complete; most version-specific features are present, but some are missing. +ERROR: 0:3: 'implicitly-sized array in a block' : not supported with this profile: es +ERROR: 1 compilation errors. No code generated. + + +Shader version: 310 +ERROR: node is still EOpNull! +0:6 Function Definition: main( (global void) +0:6 Function Parameters: +0:7 Sequence +0:7 move second child to first child (temp highp int) +0:7 'o' (layout(location=0 ) smooth out highp int) +0:7 direct index (layout(column_major shared ) temp highp int) +0:7 a: direct index for structure (layout(column_major shared ) uniform implicitly-sized array of highp int) +0:7 'uni' (layout(location=0 column_major shared ) uniform block{layout(column_major shared ) uniform implicitly-sized array of highp int a}) +0:7 Constant: +0:7 0 (const int) +0:7 Constant: +0:7 2 (const int) +0:? Linker Objects +0:? 'uni' (layout(location=0 column_major shared ) uniform block{layout(column_major shared ) uniform implicitly-sized array of highp int a}) +0:? 'o' (layout(location=0 ) smooth out highp int) +0:? 'gl_VertexID' (gl_VertexId highp int) +0:? 'gl_InstanceID' (gl_InstanceId highp int) + + +Linked vertex stage: + + +Shader version: 310 +ERROR: node is still EOpNull! +0:6 Function Definition: main( (global void) +0:6 Function Parameters: +0:7 Sequence +0:7 move second child to first child (temp highp int) +0:7 'o' (layout(location=0 ) smooth out highp int) +0:7 direct index (layout(column_major shared ) temp highp int) +0:7 a: direct index for structure (layout(column_major shared ) uniform 1-element array of highp int) +0:7 'uni' (layout(location=0 column_major shared ) uniform block{layout(column_major shared ) uniform 1-element array of highp int a}) +0:7 Constant: +0:7 0 (const int) +0:7 Constant: +0:7 2 (const int) +0:? Linker Objects +0:? 'uni' (layout(location=0 column_major shared ) uniform block{layout(column_major shared ) uniform 1-element array of highp int a}) +0:? 'o' (layout(location=0 ) smooth out highp int) +0:? 'gl_VertexID' (gl_VertexId highp int) +0:? 'gl_InstanceID' (gl_InstanceId highp int) + diff --git a/Test/testlist b/Test/testlist index d76f970b..be4a8818 100644 --- a/Test/testlist +++ b/Test/testlist @@ -36,12 +36,13 @@ comment.frag 300layout.frag 300operations.frag 300block.frag -310.comp -310.vert -310.frag -330.frag -330comp.frag -constErrors.frag +310.comp +310.vert +310.frag +310implicitSizeArrayError.vert +330.frag +330comp.frag +constErrors.frag constFold.frag errors.frag forwardRef.frag diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 1c72b586..a9f9e6c0 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -2551,7 +2551,10 @@ void TParseContext::updateImplicitArraySize(TSourceLoc loc, TIntermNode *node, i else if (node->getAsBinaryNode()) { const TIntermBinary* deref = node->getAsBinaryNode(); // This has to be the result of a block dereference, unless it's bad shader code + // If it's a uniform block, then an error will be issued elsewhere, but + // return early now to avoid crashing later in this function. if (! deref->getLeft()->getAsSymbolNode() || deref->getLeft()->getBasicType() != EbtBlock || + deref->getLeft()->getType().getQualifier().storage == EvqUniform || deref->getRight()->getAsConstantUnion() == 0) return;