Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
2184c2f2
Commit
2184c2f2
authored
Apr 03, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #287: pin down the io-array size before checking for out of range index.
parent
6f03bfc7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
57 deletions
+73
-57
450.geom
Test/450.geom
+3
-0
450.geom.out
Test/baseResults/450.geom.out
+60
-49
revision.h
glslang/Include/revision.h
+2
-2
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+8
-6
No files found.
Test/450.geom
View file @
2184c2f2
...
...
@@ -8,7 +8,10 @@ out gl_PerVertex {
float
gl_CullDistance
[
3
];
};
layout
(
triangles
)
in
;
void
main
()
{
gl_in
[
3
].
gl_Position
;
// ERROR, out of range
gl_CullDistance
[
2
]
=
gl_in
[
1
].
gl_CullDistance
[
2
];
}
Test/baseResults/450.geom.out
View file @
2184c2f2
450.geom
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
ERROR: 0:15: '[' : array index out of range '3'
ERROR: 0:15: 'gl_Position' : no such field in structure
ERROR: 2 compilation errors. No code generated.
Shader version: 450
invocations = -1
max_vertices = -1
input primitive =
none
input primitive =
triangles
output primitive = none
0:? Sequence
0:11 Function Definition: main( ( global void)
0:11 Function Parameters:
0:13 Sequence
0:13 move second child to first child ( temp float)
0:13 direct index (layout( stream=0) temp float CullDistance)
0:13 gl_CullDistance: direct index for structure (layout( stream=0) out 3-element array of float CullDistance)
0:13 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-element array of float CullDistance gl_CullDistance})
0:13 Constant:
0:13 3 (const uint)
0:13 Constant:
0:13 2 (const int)
0:13 direct index ( temp float CullDistance)
0:13 gl_CullDistance: direct index for structure ( in 3-element array of float CullDistance)
0:13 direct index ( temp block{ in 3-element array of float CullDistance gl_CullDistance})
0:13 'gl_in' ( in implicitly-sized array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:13 Constant:
0:13 1 (const int)
0:13 Constant:
0:13 0 (const int)
0:13 Constant:
0:13 2 (const int)
ERROR: node is still EOpNull!
0:13 Function Definition: main( ( global void)
0:13 Function Parameters:
0:15 Sequence
0:15 direct index ( temp block{ in 3-element array of float CullDistance gl_CullDistance})
0:15 'gl_in' ( in 3-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:15 Constant:
0:15 3 (const int)
0:16 move second child to first child ( temp float)
0:16 direct index (layout( stream=0) temp float CullDistance)
0:16 gl_CullDistance: direct index for structure (layout( stream=0) out 3-element array of float CullDistance)
0:16 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-element array of float CullDistance gl_CullDistance})
0:16 Constant:
0:16 3 (const uint)
0:16 Constant:
0:16 2 (const int)
0:16 direct index ( temp float CullDistance)
0:16 gl_CullDistance: direct index for structure ( in 3-element array of float CullDistance)
0:16 direct index ( temp block{ in 3-element array of float CullDistance gl_CullDistance})
0:16 'gl_in' ( in 3-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:16 Constant:
0:16 1 (const int)
0:16 Constant:
0:16 0 (const int)
0:16 Constant:
0:16 2 (const int)
0:? Linker Objects
0:? 'gl_in' ( in
implicitly-sized
array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'gl_in' ( in
3-element
array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-element array of float CullDistance gl_CullDistance})
Linked geometry stage:
ERROR: Linking geometry stage: At least one shader must specify an input layout primitive
ERROR: Linking geometry stage: At least one shader must specify an output layout primitive
ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
Shader version: 450
invocations = 1
max_vertices = -1
input primitive =
none
input primitive =
triangles
output primitive = none
0:? Sequence
0:11 Function Definition: main( ( global void)
0:11 Function Parameters:
0:13 Sequence
0:13 move second child to first child ( temp float)
0:13 direct index (layout( stream=0) temp float CullDistance)
0:13 gl_CullDistance: direct index for structure (layout( stream=0) out 3-element array of float CullDistance)
0:13 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-element array of float CullDistance gl_CullDistance})
0:13 Constant:
0:13 3 (const uint)
0:13 Constant:
0:13 2 (const int)
0:13 direct index ( temp float CullDistance)
0:13 gl_CullDistance: direct index for structure ( in 3-element array of float CullDistance)
0:13 direct index ( temp block{ in 3-element array of float CullDistance gl_CullDistance})
0:13 'gl_in' ( in 2-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:13 Constant:
0:13 1 (const int)
0:13 Constant:
0:13 0 (const int)
0:13 Constant:
0:13 2 (const int)
ERROR: node is still EOpNull!
0:13 Function Definition: main( ( global void)
0:13 Function Parameters:
0:15 Sequence
0:15 direct index ( temp block{ in 3-element array of float CullDistance gl_CullDistance})
0:15 'gl_in' ( in 3-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:15 Constant:
0:15 3 (const int)
0:16 move second child to first child ( temp float)
0:16 direct index (layout( stream=0) temp float CullDistance)
0:16 gl_CullDistance: direct index for structure (layout( stream=0) out 3-element array of float CullDistance)
0:16 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-element array of float CullDistance gl_CullDistance})
0:16 Constant:
0:16 3 (const uint)
0:16 Constant:
0:16 2 (const int)
0:16 direct index ( temp float CullDistance)
0:16 gl_CullDistance: direct index for structure ( in 3-element array of float CullDistance)
0:16 direct index ( temp block{ in 3-element array of float CullDistance gl_CullDistance})
0:16 'gl_in' ( in 3-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:16 Constant:
0:16 1 (const int)
0:16 Constant:
0:16 0 (const int)
0:16 Constant:
0:16 2 (const int)
0:? Linker Objects
0:? 'gl_in' ( in
2
-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'gl_in' ( in
3
-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-element array of float CullDistance gl_CullDistance})
glslang/Include/revision.h
View file @
2184c2f2
...
...
@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "Overload400-PrecQual.19
58
"
#define GLSLANG_DATE "
31-Ma
r-2017"
#define GLSLANG_REVISION "Overload400-PrecQual.19
65
"
#define GLSLANG_DATE "
03-Ap
r-2017"
glslang/MachineIndependent/ParseHelper.cpp
View file @
2184c2f2
...
...
@@ -342,10 +342,8 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
TIntermTyped
*
result
=
nullptr
;
int
indexValue
=
0
;
if
(
index
->
getQualifier
().
isFrontEndConstant
())
{
if
(
index
->
getQualifier
().
isFrontEndConstant
())
indexValue
=
index
->
getAsConstantUnion
()
->
getConstArray
()[
0
].
getIConst
();
checkIndex
(
loc
,
base
->
getType
(),
indexValue
);
}
variableCheck
(
base
);
if
(
!
base
->
isArray
()
&&
!
base
->
isMatrix
()
&&
!
base
->
isVector
())
{
...
...
@@ -353,10 +351,12 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
error
(
loc
,
" left of '[' is not of type array, matrix, or vector "
,
base
->
getAsSymbolNode
()
->
getName
().
c_str
(),
""
);
else
error
(
loc
,
" left of '[' is not of type array, matrix, or vector "
,
"expression"
,
""
);
}
else
if
(
base
->
getType
().
getQualifier
().
isFrontEndConstant
()
&&
index
->
getQualifier
().
isFrontEndConstant
())
}
else
if
(
base
->
getType
().
getQualifier
().
isFrontEndConstant
()
&&
index
->
getQualifier
().
isFrontEndConstant
())
{
// both base and index are front-end constants
checkIndex
(
loc
,
base
->
getType
(),
indexValue
);
return
intermediate
.
foldDereference
(
base
,
indexValue
,
loc
);
else
{
// at least one of base and index is variable...
}
else
{
// at least one of base and index is
not a front-end constant
variable...
if
(
base
->
getAsSymbolNode
()
&&
isIoResizeArray
(
base
->
getType
()))
handleIoResizeArrayAccess
(
loc
,
base
);
...
...
@@ -364,6 +364,8 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
if
(
index
->
getQualifier
().
isFrontEndConstant
())
{
if
(
base
->
getType
().
isImplicitlySizedArray
())
updateImplicitArraySize
(
loc
,
base
,
indexValue
);
else
checkIndex
(
loc
,
base
->
getType
(),
indexValue
);
result
=
intermediate
.
addIndex
(
EOpIndexDirect
,
base
,
index
,
loc
);
}
else
{
if
(
base
->
getType
().
isImplicitlySizedArray
())
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment