KhronosGroup / KhronosGroup/glslang

HLSL: crashes when multiplying 1D vectors/matrices

Open
#3,129 1 comment 0 reactions 0 assignees View on GitHub
bug HLSL
Dominant language
C++
Stars
3.6k
Forks
989
Avg merge
1d 2h
Merged PRs (30d)
31

Description

This code:
```hlsl
//glslangValidator -e PSMain -H -D test.frag.hlsl

float4 PSMain(float4x1 a, float1 b) : SV_TARGET {
return mul(a, b);
}
```
Crashes with:
```
glslangValidator: glslang/SPIRV/GlslangToSpv.cpp:6529: spv::Id {anonymous}::TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op, {anonymous}::{anonymous}::OpDecorations&, spv::Id, spv::Id, spv::Id): Assertion `builder.isVector(left)' failed.
Aborted (core dumped)
```

Stack trace

```
#5 0x00007fe0f5d62486 in __GI___assert_fail (assertion=0x5565ba1d3667 "builder.isVector(left)",
file=0x5565ba1d1708 "glslang/SPIRV/GlslangToSpv.cpp", line=6529,
function=0x5565ba1d35d0 "spv::Id {anonymous}::TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op, {anonymous}::{anonymous}::OpDecorations&, spv::Id, spv::Id, spv::Id)") at assert.c:101
No locals.
#6 0x00005565b9b3a12d in (anonymous namespace)::TGlslangToSpvTraverser::createBinaryMatrixOperation (this=0x7fff79e4d200, op=spv::OpVectorTimesMatrix,
decorations=..., typeId=11, left=17, right=18) at glslang/SPIRV/GlslangToSpv.cpp:6529
firstClass = true
__PRETTY_FUNCTION__ = "spv::Id {anonymous}::TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op, {anonymous}::{anonymous}::OpDecorations&, spv::Id, spv::Id, spv::Id)"
#7 0x00005565b9b39ba9 in (anonymous namespace)::TGlslangToSpvTraverser::createBinaryOperation (this=0x7fff79e4d200, op=glslang::EOpVectorTimesMatrix,
decorations=..., typeId=11, left=17, right=18, typeProxy=glslang::EbtFloat, reduceComparison=true)
at glslang/SPIRV/GlslangToSpv.cpp:6404
result = 32767
isUnsigned = false
isFloat = true
isBool = false
binOp = spv::OpVectorTimesMatrix
needMatchingVectors = true
comparison = false
__PRETTY_FUNCTION__ = "spv::Id {anonymous}::TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator, {anonymous}::{anonymous}::OpDecorations&, spv::Id, spv::Id, spv::Id, glslang::TBasicType, bool)"
#8 0x00005565b9b26eb4 in (anonymous namespace)::TGlslangToSpvTraverser::visitBinary (this=0x7fff79e4d200, node=0x5565bb671cb8)
at glslang/SPIRV/GlslangToSpv.cpp:2349
spec_constant_op_mode_setter = {builder_ = 0x7fff79e4d268, previous_flag_ = false}
__PRETTY_FUNCTION__ = "virtual bool {anonymous}::TGlslangToSpvTraverser::visitBinary(glslang::TVisit, glslang::TIntermBinary*)"
left = 17
right = 18
decorations = {precision = spv::DecorationMax, noContraction = spv::DecorationMax, nonUniform = spv::DecorationMax}
result = 0
#9 0x00005565b9cf7fb2 in glslang::TIntermBinary::traverse (this=0x5565bb671cb8, it=0x7fff79e4d200) at glslang/glslang/MachineIndependent/IntermTraverse.cpp:92
visit = true
#10 0x00005565b9b2e87c in (anonymous namespace)::TGlslangToSpvTraverser::visitBranch (this=0x7fff79e4d200, node=0x5565bb671dc8) at glslang/SPIRV/GlslangToSpv.cpp:4035
__PRETTY_FUNCTION__ = "virtual bool {anonymous}::TGlslangToSpvTraverser::visitBranch(glslang::TVisit, glslang::TIntermBranch*)"
#11 0x00005565b9cf8956 in glslang::TIntermBranch::traverse (this=0x5565bb671dc8, it=0x7fff79e4d200) at glslang/glslang/MachineIndependent/IntermTraverse.cpp:271
visit = true
#12 0x00005565b9cf841b in glslang::TIntermAggregate::traverse (this=0x5565bb671e38, it=0x7fff79e4d200) at glslang/glslang/MachineIndependent/IntermTraverse.cpp:175
sit = 0x5565bb671dc8
visit = true
#13 0x00005565b9cf841b in glslang::TIntermAggregate::traverse (this=0x5565bb672018, it=0x7fff79e4d200) at glslang/glslang/MachineIndependent/IntermTraverse.cpp:175
sit = 0x5565bb671e38
visit = true
#14 0x00005565b9b351e2 in (anonymous namespace)::TGlslangToSpvTraverser::visitFunctions (this=0x7fff79e4d200, glslFunctions=...) at glslang/SPIRV/GlslangToSpv.cpp:5392
node = 0x5565bb672018
f = 0
#15 0x00005565b9b29c44 in (anonymous namespace)::TGlslangToSpvTraverser::visitAggregate (this=0x7fff79e4d200, visit=glslang::EvPreVisit, node=0x5565bb6722f8) at glslang/SPIRV/GlslangToSpv.cpp:2880
spec_constant_op_mode_setter = {builder_ = 0x7fff79e4d268, previous_flag_ = false}
result = 0
invertedType = 0
complexLvalues = std::vector of length 0, capacity 0
temporaryLvalues = std::vector of length 0, capacity 0
resultType = {__invertedType = @0x7fff79e4cecc, __node = @0x7fff79e4cea8, __this = 0x7fff79e4d200}
binOp = glslang::EOpNull
reduceComparison = true
isMatrix = false
noReturnValue = false
atomic = false
lvalueCoherentFlags = {coherent = 0, devicecoherent = 0, queuefamilycoherent = 0, workgroupcoherent = 0, subgroupcoherent = 0, shadercallcoherent = 0, nonprivate = 0, volatil = 0, isImage = 0, nonUniform = 0}
__PRETTY_FUNCTION__ = "virtual bool {anonymous}::TGlslangToSpvTraverser::visitAggregate(glslang::TVisit, glslang::TIntermAggregate*)"
precision = spv::DecorationMax
glslangOperands = @0x7fff79e4cfa8: { >> = std::vector of length 0, capacity 0, }
operands = std::vector of length -11709955271572, capacity 35185445830784 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2045043056, 32767, 0, 0, 2045042944, 32767, 3115402697, 21861, 2045043088, 32767, 0, 0, 1953719552, 1634887214, 1818766951, 2130734195, 2045043464, 32767, 2859106816, 2135809026, 2045044040, 32767, 3137235544, 21861, 2045043408, 32767, 3115381618, 21861, 2045043328, 32767, 2045043456, 32767, 2045043200, 32767, 0, 0, 3137289552, 21861, 1674625756, 1170138593, 6, 0, 0, 0, 3137285440, 21861, 3137285496, 21861, 3137285496, 21861, 2859106816, 2135809026, 3137285504, 21861, 3137285560, 21861, 3137285560, 21861, 3116983740, 21861, 2045043328, 32767, 3137284080, 21861, 2045044040, 32767, 3118088783, 21861, 2045043392, 32767, 3116146450, 21861, 2045044040, 32767, 2859106816, 2135809026, 4, 1, 3137289552, 21861, 2045043376, 32767, 14, 0, 1953719668, 1634887214, 1818766951, 27763, 2045043376, 32767, 2859106816, 2135809026, 2045043712, 32767, 3115383138, 21861, 2045043472, 32767, 2045043592, 32767, 2045043504, 32767, 3115399397, 21861, 3126332936, 21861, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2045043504, 32767, 2045043504, 32767, 0, 0, 2045044088, 32767, 4129512992, 0, 3126702928, 21861, 4129488320, 32736, 4129463768, 6, 2045043528, 32767, 2045043528, 32767, 2045043528, 32767, 0, 0, 2045043540, 32767, 2045043528, 32767, 3137230256, 21861, 4124863646, 32736, 3137234480, 21861, 1040, 0, 2045043664, 32767, 14, 0, 1953719668, 1634887214, 2859106816, 2135809026, 3137234464, 21861, 2045044040, 32767, 0, 0, 2045044096, 32767, 2045043760, 32767, 3115384040, 21861, 2045044040, 32767, 4126185312, 6...}
memoryAccessOperands = std::vector of length -120259750027, capacity 1152921383294617600 = {
#16 0x00005565b9cf82b2 in glslang::TIntermAggregate::traverse (this=0x5565bb6722f8, it=0x7fff79e4d200) at glslang/glslang/MachineIndependent/IntermTraverse.cpp:159
visit = true
#17 0x00005565b9b45479 in glslang::GlslangToSpv (intermediate=..., spirv=std::vector of length 0, capacity 0, logger=0x7fff79e4e100, options=0x7fff79e4e018) at glslang/SPIRV/GlslangToSpv.cpp:9969
root = 0x5565bb6722f8
defaultOptions = {generateDebugInfo = false, stripDebugInfo = false, disableOptimizer = true, optimizeSize = false, disassemble = false, validate = false, emitNonSemanticShaderDebugInfo = false, emitNonSemanticShaderDebugSource = false}
it = { = {_vptr.TIntermTraverser = 0x5565ba581660 , preVisit = true, inVisit = false, postVisit = true, rightToLeft = false, depth = 2, maxDepth = 2, path = { >> = std::vector of length 2, capacity 2 = {0x5565bb672018, 0x5565bb671e38}, }}, options = @0x7fff79e4e018, shaderEntry = 0x5565baff67e0, currentFunction = 0x5565baff7330, entryPoint = 0x5565baff6a90, sequenceDepth = 2, logger = 0x7fff79e4e100, builder = {_vptr.Builder = 0x5565ba5cfe18 , static maxMatrixSize = 4, debugTypeLocs = std::unordered_map with 0 elements, spvVersion = 65536, sourceLang = spv::SourceLanguageHLSL, sourceVersion = 500, sourceFileStringId = 0, nonSemanticShaderCompilationUnitId = 0, nonSemanticShaderDebugInfo = 0, debugInfoNone = 0, debugExpression = 0, sourceText = "", currentLine = 2, currentFile = 0x5565bb64b4f0 "test.frag.hlsl", currentFileId = 0, currentDebugScopeId = std::stack wrapping: std::deque with 0 elements, lastDebugScopeId = 0, emitOpLines = false, emitNonSemanticShaderDebugInfo = false, restoreNonSemanticShaderDebugInfo = false, emitNonSemanticShaderDebugSource = false, extensions = std::set with 0 elements, sourceExtensions = std::vector of length 0, capacity 0, moduleProcesses = std::vector of length 0, capacity 0, addressModel = spv::AddressingModelLogical, memoryModel = spv::MemoryModelGLSL450, capabilities = std::set with 1 element = {[0] = spv::CapabilityShader}, builderNumber = 524299, module = {_vptr.Module = 0x5565ba5cfe38 , functions = std::vector of length 2, capacity 2 = {0x5565baff67e0, 0x5565baff7330}, idToInstruction = std::vector of length 33, capacity 34 = {0x0, 0x5565baff3f90, 0x5565bb043310, 0x5565baff6770, 0x5565baff67f8, 0x5565baff68f0, 0x5565baff6c90, 0x5565baff6d60, 0x5565baff6e40, 0x5565baff6f60, 0x5565baff7050, 0x5565baff7140, 0x5565baff71f0, 0x5565baff7460, 0x5565baff74d0, 0x5565baff7348, 0x5565baff7560, 0x5565baff7980, 0x5565baff7b10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}, buildPoint = 0x5565bb043380, uniqueId = 18, entryPointFunction = 0x5565baff67e0, generatingOpCodeForSpecConst = false, accessChain = {base = 13, indexChain = std::vector of length 0, capacity 0, instr = 0, swizzle = std::vector of length 0, capacity 0, component = 0, preSwizzleBaseType = 0, isRValue = false, alignment = 0, coherentFlags = {coherent = 0, devicecoherent = 0, queuefamilycoherent = 0, workgroupcoherent = 0, subgroupcoherent = 0, shadercallcoherent = 0, nonprivate = 0, volatil = 0, isImage = 0, nonUniform = 0}}, strings = std::vector of length 0, capacity 0, imports = std::vector of length 1, capacity 1 = {std::unique_ptr = {get() = 0x5565baff3f90}}, entryPoints = std::vector of length 1, capacity 1 = {std::unique_ptr = {get() = 0x5565baff6a90}}, executionModes = std::vector of length 1, capacity 1 = {std::unique_ptr = {get() = 0x5565baff4080}}, names = std::vector of length 4, capacity 4 = {std::unique_ptr = {get() = 0x5565baff69a0}, std::unique_ptr = {get() = 0x5565baff75f0}, std::unique_ptr = {get() = 0x5565baff77d0}, std::unique_ptr = {get() = 0x5565baff78d0}}, decorations = std::vector of length 0, capacity 0, constantsTypesGlobals = std::vector of length 9, capacity 16 = {std::unique_ptr = {get() = 0x5565bb043310}, std::unique_ptr = {get() = 0x5565baff6770}, std::unique_ptr = {get() = 0x5565baff6c90}, std::unique_ptr = {get() = 0x5565baff6d60}, std::unique_ptr = {get() = 0x5565baff6e40}, std::unique_ptr = {get() = 0x5565baff6f60}, std::unique_ptr = {get() = 0x5565baff7050}, std::unique_ptr = {get() = 0x5565baff7140}, std::unique_ptr = {get() = 0x5565baff71f0}}, externals = std::vector of length 0, capacity 0, functions = std::vector of length 2, capacity 2 = {std::unique_ptr = {get() = 0x5565baff67e0}, std::unique_ptr = {get() = 0x5565baff7330}}, groupedConstants = std::unordered_map with 0 elements, groupedStructConstants = std::unordered_map with 0 elements, groupedTypes = std::unordered_map with 6 elements = {[24] = std::vector of length 1, capacity 1 = {0x5565baff6e40}, [23] = std::vector of length 2, capacity 2 = {0x5565baff6d60, 0x5565baff7140}, [22] = std::vector of length 1, capacity 1 = {0x5565baff6c90}, [33] = std::vector of length 2, capacity 2 = {0x5565baff6770, 0x5565baff71f0}, [32] = std::vector of length 2, capacity 2 = {0x5565baff6f60, 0x5565baff7050}, [19] = std::vector of length 1, capacity 1 = {0x5565bb043310}}, groupedDebugTypes = std::unordered_map with 0 elements, nullConstants = std::vector of length 0, capacity 0, switchMerges = std::stack wrapping: std::deque with 0 elements, loops = std::stack wrapping: std::deque with 0 elements, stringIds = std::unordered_map with 0 elements, includeFiles = std::map with 0 elements, debugId = std::map with 0 elements, debugSourceId = std::unordered_map with 0 elements, logger = 0x7fff79e4e100}, inEntryPoint = false, entryPointTerminated = false, linkageOnly = false, iOSet = std::set with 0 elements, glslangIntermediate = 0x5565baff32b0, nanMinMaxClamp = false, stdBuiltins = 1, nonSemanticDebugPrintf = 0, extBuiltinMap = std::unordered_map with 0 elements, symbolValues = std::unordered_map with 2 elements = {[288230376151715716] = 14, [288230376151715715] = 13}, builtInVariableIds = std::unordered_map with 0 elements, rValueParameters = std::unordered_set with 0 elements, functionMap = std::unordered_map with 1 element = {["@PSMain(mf41;vf1;"] = 0x5565baff7330}, structMap = {{std::unordered_map with 0 elements, std::unordered_map with 0 elements, std::unordered_map with 0 elements}, {std::unordered_map with 0 elements, std::unordered_map with 0 elements, std::unordered_map with 0 elements}, {std::unordered_map with 0 elements, std::unordered_map with 0 elements, std::unordered_map with 0 elements}, {std::unordered_map with 0 elements, std::unordered_map with 0 elements, std::unordered_map with 0 elements}, {std::unordered_map with 0 elements, std::unordered_map with 0 elements, std::unordered_map with 0 elements}, {std::unordered_map with 0 elements, std::unordered_map with 0 elements, std::unordered_map with 0 elements}}, memberRemapper = std::unordered_map with 0 elements, glslangTypeToIdMap = std::unordered_map with 0 elements, breakForLoop = std::stack wrapping: std::deque with 0 elements, counterOriginator = std::unordered_map with 0 elements, forwardPointers = std::map with 0 elements, forceType = std::unordered_map with 0 elements, taskPayloadID = 0, locationToSymbol = {std::unordered_map with 0 elements, std::unordered_map with 0 elements, std::unordered_map with 0 elements, std::unordered_map with 0 elements}}
prelegalization = false
#18 0x00005565b9b0ed1e in CompileAndLinkShaderUnits (compUnits=std::vector of length 1, capacity 1 = {...}) at glslang/StandAlone/StandAlone.cpp:1501
spirv = std::vector of length 0, capacity 0
logger = {tbdFeatures = std::vector of length 0, capacity 0, missingFeatures = std::vector of length 0, capacity 0, warnings = std::vector of length 0, capacity 0, errors = std::vector of length 0, capacity 0}
spvOptions = {generateDebugInfo = false, stripDebugInfo = false, disableOptimizer = false, optimizeSize = false, disassemble = false, validate = false, emitNonSemanticShaderDebugInfo = false, emitNonSemanticShaderDebugSource = false}
stage = 4
shaders = std::__cxx11::list = {[0] = 0x5565baff3050}
messages = 88
includer = { = {_vptr.Includer = 0x5565ba580da0 }, directoryStack = std::vector of length 0, capacity 0, externalLocalDirectoryCount = 0, includedFiles = std::set with 0 elements}
sources = std::vector of length 1, capacity 1 = {"test.frag.hlsl"}
program = @0x5565baff2dc0: {_vptr.TProgram = 0x5565ba5cfeb8 , pool = 0x5565bafe6c20, stages = {empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, std::__cxx11::list = {[0] = 0x5565baff3050}, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list}, intermediate = {0x0, 0x0, 0x0, 0x0, 0x5565baff32b0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, newedIntermediate = {false }, infoSink = 0x5565baff2fc0, reflection = 0x0, linked = true}
outputFiles = std::vector of length 0, capacity 0
#19 0x00005565b9b0f372 in CompileAndLinkShaderFiles (Worklist=...) at glslang/StandAlone/StandAlone.cpp:1592
j = 0
i = 0
compUnits = std::vector of length 1, capacity 1 = {{stage = EShLangFragment, static maxCount = 1, count = 1, text = {0x5565baff3d50 "float4 PSMain(float4x1 a, float1 b) : SV_TARGET { \n return mul(a, b);\n}\n"}, fileName = {"test.frag.hlsl"}, fileNameList = {0x7fff79e4e2b0 "test.frag.hlsl"}}}
#20 0x00005565b9b0f962 in singleMain () at glslang/StandAlone/StandAlone.cpp:1667
workList = {_vptr.TWorklist = 0x5565ba580e08 , mutex = { = {_M_mutex = {__data = {__lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = '\000' , __align = 0}}, }, worklist = empty std::__cxx11::list}
#21 0x00005565b9b0fce8 in main (argc=6, argv=0x7fff79e4e548) at glslang/StandAlone/StandAlone.cpp:1721
i = 0
ret = 0
iterations = 1

```

If I get the dimensions wrong:
```hlsl
//glslangValidator -e PSMain -H -D test.frag.hlsl

float4 PSMain(float1x4 a, float1 b) : SV_TARGET {
return mul(a, b);
}
```
Rather than emitting a diagnostic, it crashes even harder:
```
Segmentation fault (core dumped)
```

Stack trace

```
#0 0x0000558516765c8a in glslang::HlslParseContext::addGenMulArgumentConversion (this=0x5585191b0150, loc=..., call=...,
args=@0x7ffd9d630900: 0x55851982ba88) at glslang/glslang/HLSL/hlslParseHelper.cpp:5752
argAggregate = 0x55851982ba88
arg0 = 0x0
arg1 = 0x55851982b808
#1 0x0000558516764253 in glslang::HlslParseContext::handleFunctionCall (this=0x5585191b0150, loc=..., function=0x55851982b358, arguments=0x55851982ba88)
at glslang/glslang/HLSL/hlslParseHelper.cpp:5517
fnCandidate = 0x0
builtIn = false
thisDepth = 0
aggregate = 0x7ffd9d6309f8
result = 0x0
op = glslang::EOpNull
#2 0x00005585167b1963 in glslang::HlslGrammar::acceptFunctionCall (this=0x7ffd9d6317c0, loc=..., name="mul", node=@0x7ffd9d631360: 0x0, baseObject=0x0)
at glslang/glslang/HLSL/hlslGrammar.cpp:3559
functionName = 0x55851982b2f8
function = 0x55851982b358
arguments = 0x55851982ba88
#3 0x00005585167b1130 in glslang::HlslGrammar::acceptPostfixExpression (this=0x7ffd9d6317c0, node=@0x7ffd9d631360: 0x0)
at glslang/glslang/HLSL/hlslGrammar.cpp:3398
fullName = 0x55851982b2f8
idToken = {loc = {name = 0x5585198054d8, string = 0, line = 2, column = 10}, tokenClass = glslang::EHTokIdentifier, {string = 0x55851982b2f8,
i = 427995896, u = 427995896, b = 248, d = 4.6457065309671481e-310}}
__PRETTY_FUNCTION__ = "bool glslang::HlslGrammar::acceptPostfixExpression(glslang::TIntermTyped*&)"
#4 0x00005585167b0d77 in glslang::HlslGrammar::acceptUnaryExpression (this=0x7ffd9d6317c0, node=@0x7ffd9d631360: 0x0)
at glslang/glslang/HLSL/hlslGrammar.cpp:3322
unaryOp = glslang::EOpNull
loc = {name = 0x28, string = -1654452872, line = 32765, column = -1654452632}
#5 0x00005585167b08a7 in glslang::HlslGrammar::acceptBinaryExpression (this=0x7ffd9d6317c0, node=@0x7ffd9d631360: 0x0, precedenceLevel=12)
at glslang/glslang/HLSL/hlslGrammar.cpp:3226
No locals.
#6 0x00005585167b08c7 in glslang::HlslGrammar::acceptBinaryExpression (this=0x7ffd9d6317c0, node=@0x7ffd9d631360: 0x0, precedenceLevel=glslang::PlMul)
at glslang/glslang/HLSL/hlslGrammar.cpp:3229
No locals.
#7 0x00005585167b08c7 in glslang::HlslGrammar::acceptBinaryExpression (this=0x7ffd9d6317c0, node=@0x7ffd9d631360: 0x0, precedenceLevel=glslang::PlAdd)
at glslang/glslang/HLSL/hlslGrammar.cpp:3229
No locals.
#8 0x00005585167b08c7 in glslang::HlslGrammar::acceptBinaryExpression (this=0x7ffd9d6317c0, node=@0x7ffd9d631360: 0x0, precedenceLevel=glslang::PlShift)
at glslang/glslang/HLSL/hlslGrammar.cpp:3229
No locals.
#9 0x00005585167b08c7 in glslang::HlslGrammar::acceptBinaryExpression (this=0x7ffd9d6317c0, node=@0x7ffd9d631360: 0x0,
precedenceLevel=glslang::PlRelational) at glslang/glslang/HLSL/hlslGrammar.cpp:3229
No locals.
#10 0x00005585167b08c7 in glslang::HlslGrammar::acceptBinaryExpression (this=0x7ffd9d6317c0, node=@0x7ffd9d631360: 0x0, precedenceLevel=glslang::PlEquality)
at glslang/glslang/HLSL/hlslGrammar.cpp:3229
No locals.
#11 0x00005585167b08c7 in glslang::HlslGrammar::acceptBinaryExpression (this=0x7ffd9d6317c0, node=@0x7ffd9d631360: 0x0, precedenceLevel=glslang::PlBitwiseAnd) at glslang/glslang/HLSL/hlslGrammar.cpp:3229
No locals.
#12 0x00005585167b08c7 in glslang::HlslGrammar::acceptBinaryExpression (this=0x7ffd9d6317c0, node=@0x7ffd9d631360: 0x0, precedenceLevel=glslang::PlBitwiseXor) at glslang/glslang/HLSL/hlslGrammar.cpp:3229
No locals.
#13 0x00005585167b08c7 in glslang::HlslGrammar::acceptBinaryExpression (this=0x7ffd9d6317c0, node=@0x7ffd9d631360: 0x0, precedenceLevel=glslang::PlBitwiseOr) at glslang/glslang/HLSL/hlslGrammar.cpp:3229
No locals.
#14 0x00005585167b08c7 in glslang::HlslGrammar::acceptBinaryExpression (this=0x7ffd9d6317c0, node=@0x7ffd9d631360: 0x0, precedenceLevel=glslang::PlLogicalAnd) at glslang/glslang/HLSL/hlslGrammar.cpp:3229
No locals.
#15 0x00005585167b08c7 in glslang::HlslGrammar::acceptBinaryExpression (this=0x7ffd9d6317c0, node=@0x7ffd9d631360: 0x0, precedenceLevel=glslang::PlLogicalXor) at glslang/glslang/HLSL/hlslGrammar.cpp:3229
No locals.
#16 0x00005585167b08c7 in glslang::HlslGrammar::acceptBinaryExpression (this=0x7ffd9d6317c0, node=@0x7ffd9d631360: 0x0, precedenceLevel=glslang::PlLogicalOr) at glslang/glslang/HLSL/hlslGrammar.cpp:3229
No locals.
#17 0x00005585167b069f in glslang::HlslGrammar::acceptConditionalExpression (this=0x7ffd9d6317c0, node=@0x7ffd9d631360: 0x0) at glslang/glslang/HLSL/hlslGrammar.cpp:3176
trueNode = 0x7ffd9d631280
loc = {name = 0x7ffd9d631290, string = 378081207, line = 21893, column = -1654451488}
falseNode = 0x7ffd9d6317c0
#18 0x00005585167b04d2 in glslang::HlslGrammar::acceptAssignmentExpression (this=0x7ffd9d6317c0, node=@0x7ffd9d631360: 0x0) at glslang/glslang/HLSL/hlslGrammar.cpp:3130
assignOp = 32765
loc = {name = 0x7ffd9d631330, string = 378080804, line = 21893, column = -1654451472}
rightNode = 0x1319d6317f8
#19 0x00005585167b00f3 in glslang::HlslGrammar::acceptExpression (this=0x7ffd9d6317c0, node=@0x7ffd9d631360: 0x0) at glslang/glslang/HLSL/hlslGrammar.cpp:3024
No locals.
#20 0x00005585167b3194 in glslang::HlslGrammar::acceptJumpStatement (this=0x7ffd9d6317c0, statement=@0x7ffd9d6313f0: 0x0) at glslang/glslang/HLSL/hlslGrammar.cpp:4167
node = 0x0
jump = glslang::EHTokReturn
__PRETTY_FUNCTION__ = "bool glslang::HlslGrammar::acceptJumpStatement(TIntermNode*&)"
#21 0x00005585167b20af in glslang::HlslGrammar::acceptStatement (this=0x7ffd9d6317c0, statement=@0x7ffd9d6313f0: 0x0) at glslang/glslang/HLSL/hlslGrammar.cpp:3762
attributes = { >> = empty std::__cxx11::list, }
#22 0x00005585167b1e7c in glslang::HlslGrammar::acceptCompoundStatement (this=0x7ffd9d6317c0, retStatement=@0x7ffd9d631460: 0x0) at glslang/glslang/HLSL/hlslGrammar.cpp:3682
compoundStatement = 0x0
statement = 0x0
#23 0x00005585167afe9c in glslang::HlslGrammar::acceptFunctionBody (this=0x7ffd9d6317c0, declarator=..., nodeList=@0x7ffd9d631920: 0x0) at glslang/glslang/HLSL/hlslGrammar.cpp:2960
entryPointNode = 0x55851982a788
functionNode = 0x55851982aac8
functionBody = 0x0
#24 0x00005585167afe21 in glslang::HlslGrammar::acceptFunctionDefinition (this=0x7ffd9d6317c0, declarator=..., nodeList=@0x7ffd9d631920: 0x0, deferredTokens=0x0) at glslang/glslang/HLSL/hlslGrammar.cpp:2946
No locals.
#25 0x00005585167a6d22 in glslang::HlslGrammar::acceptDeclaration (this=0x7ffd9d6317c0, nodeList=@0x7ffd9d631920: 0x0) at glslang/glslang/HLSL/hlslGrammar.cpp:432
fullName = 0x558519827fd8
declarator_list = false
declarator = {loc = {name = 0x5585198054d8, string = 0, line = 1, column = 49}, function = 0x558519828038, attributes = { >> = empty std::__cxx11::list, }, body = 0x0}
typedefDecl = false
declaredType = {_vptr.TType = 0x5585170dac18 , basicType = glslang::EbtFloat, vectorSize = 4, matrixCols = 0, matrixRows = 0, vector1 = false, coopmat = false, qualifier = {static layoutNotSet = -1, semanticName = 0x0, storage = glslang::EvqTemporary, builtIn = glslang::EbvNone, declaredBuiltIn = glslang::EbvNone, precision = glslang::EpqNone, invariant = false, centroid = false, smooth = false, flat = false, specConstant = false, nonUniform = false, explicitOffset = false, defaultBlock = false, noContraction = false, nopersp = false, explicitInterp = false, pervertexNV = false, pervertexEXT = false, perPrimitiveNV = false, perViewNV = false, perTaskNV = false, patch = false, sample = false, restrict = false, readonly = false, writeonly = false, coherent = false, volatil = false, devicecoherent = false, queuefamilycoherent = false, workgroupcoherent = false, subgroupcoherent = false, shadercallcoherent = false, nonprivate = false, nullInit = false, spirvByReference = false, spirvLiteral = false, layoutMatrix = glslang::ElmNone, layoutPacking = glslang::ElpNone, layoutOffset = -1, layoutAlign = -1, layoutLocation = 4095, static layoutLocationEnd = 4095, layoutComponent = 4, static layoutComponentEnd = 4, layoutSet = 63, static layoutSetEnd = 63, layoutBinding = 65535, static layoutBindingEnd = 65535, layoutIndex = 255, static layoutIndexEnd = 255, layoutStream = 255, static layoutStreamEnd = 255, layoutXfbBuffer = 15, static layoutXfbBufferEnd = 15, layoutXfbStride = 16383, static layoutXfbStrideEnd = 16383, layoutXfbOffset = 8191, static layoutXfbOffsetEnd = 8191, layoutAttachment = 255, static layoutAttachmentEnd = 255, layoutSpecConstantId = 2047, static layoutSpecConstantIdEnd = 2047, layoutBufferReferenceAlign = 63, static layoutBufferReferenceAlignEnd = 63, layoutFormat = glslang::ElfNone, layoutPushConstant = false, layoutBufferReference = false, layoutPassthrough = false, layoutViewportRelative = false, layoutSecondaryViewportRelativeOffset = -2048, layoutShaderRecord = false, layoutHitObjectShaderRecordNV = false, spirvStorageClass = -1, spirvDecorate = 0x0, layoutBindlessSampler = false, layoutBindlessImage = false}, arraySizes = 0x0, {structure = 0x0, referentType = 0x0}, fieldName = 0x0, typeName = 0x0, sampler = {type = glslang::EbtVoid, dim = glslang::EsdNone, arrayed = false, shadow = false, ms = false, image = false, combined = false, sampler = false, vectorSize = 4, static structReturnIndexBits = 4, static structReturnSlots = 15, static noReturnStruct = 15, structReturnIndex = 15, external = false, yuv = false}, typeParameters = 0x0, spirvType = 0x0}
forbidDeclarators = false
idToken = {loc = {name = 0x5585198054d8, string = 0, line = 1, column = 8}, tokenClass = glslang::EHTokIdentifier, {string = 0x558519827fd8, i = 427982808, u = 427982808, b = 216, d = 4.645706530320515e-310}}
initializers = 0x0
#26 0x00005585167a60cf in glslang::HlslGrammar::acceptDeclarationList (this=0x7ffd9d6317c0, nodeList=@0x7ffd9d631920: 0x0) at glslang/glslang/HLSL/hlslGrammar.cpp:164
No locals.
#27 0x00005585167a5f82 in glslang::HlslGrammar::acceptCompilationUnit (this=0x7ffd9d6317c0) at glslang/glslang/HLSL/hlslGrammar.cpp:129
No locals.
#28 0x00005585167a5d0a in glslang::HlslGrammar::parse (this=0x7ffd9d6317c0) at glslang/glslang/HLSL/hlslGrammar.cpp:65
No locals.
#29 0x0000558516745bdc in glslang::HlslParseContext::parseShaderStrings (this=0x5585191b0150, ppContext=..., input=..., versionWillBeError=true) at glslang/glslang/HLSL/hlslParseHelper.cpp:134
scanContext = {_vptr.HlslScanContext = 0x5585170dbf50 , parseContext = @0x5585191b0150, ppContext = @0x7ffd9d631c00, loc = {name = 0x5585198054d8, string = 0, line = 2, column = 19}, ppToken = 0x19805478, parserToken = 0x7ffd9d6317c8, tokenText = 0x7ffd9d6305a8 "\220\006c\235\375\177", keyword = glslang::EHTokReturn}
grammar = { = {_vptr.HlslTokenStream = 0x5585170dbf10 , token = {loc = {name = 0x5585198054d8, string = 0, line = 2, column = 19}, tokenClass = glslang::EHTokSemicolon, {string = 0x55851982b7a8, i = 427997096, u = 427997096, b = 168, d = 4.645706531026436e-310}}, scanner = @0x7ffd9d631770, tokenStreamStack = { const*, glslang::pool_allocator const*> >> = std::vector of length 0, capacity 0, }, tokenPosition = { >> = std::vector of length 0, capacity 0, }, currentTokenStack = { >> = std::vector of length 0, capacity 0, }, static tokenBufferSize = 2, preTokenStack = {{loc = {name = 0x0, string = 0, line = 0, column = 0}, tokenClass = 2640517280, {string = 0x0, i = 0, u = 0, b = false, d = 0}}, {loc = {name = 0x0, string = 0, line = 0, column = 0}, tokenClass = 378204478, {string = 0x0, i = 0, u = 0, b = false, d = 0}}}, preTokenStackSize = 0, tokenBuffer = {{loc = {name = 0x5585198054d8, string = 0, line = 2, column = 17}, tokenClass = glslang::EHTokIdentifier, {string = 0x55851982b7a8, i = 427997096, u = 427997096, b = 168, d = 4.645706531026436e-310}}, {loc = {name = 0x5585198054d8, string = 0, line = 2, column = 18}, tokenClass = glslang::EHTokRightParen, {string = 0x55851982b7a8, i = 427997096, u = 427997096, b = 168, d = 4.645706531026436e-310}}}, tokenBufferPos = 0}, parseContext = @0x5585191b0150, intermediate = @0x5585191ad2b0, typeIdentifiers = false, unitNode = 0x0}
#30 0x00005585166d48eb in (anonymous namespace)::DoFullParse::operator() (this=0x7ffd9d6320cf, parseContext=..., ppContext=..., fullInput=..., versionWillBeError=true, intermediate=..., optLevel=EShOptNone, messages=88) at glslang/glslang/MachineIndependent/ShaderLang.cpp:1229
success = true
#31 0x00005585166d9ca1 in (anonymous namespace)::ProcessDeferred<(anonymous namespace)::DoFullParse> (compiler=0x5585191ad1f0, shaderStrings=0x5585191acd88, numStrings=1, inputLengths=0x0, stringNames=0x5585191acdb0, customPreamble=0x5585170e77b0 "", optLevel=EShOptNone, resources=0x5585177ea260 , defaultVersion=100, defaultProfile=ENoProfile, forceDefaultVersionAndProfile=false, overrideVersion=0, forwardCompatible=false, messages=88, intermediate=..., processingContext=..., requireNonempty=true, includer=..., sourceEntryPointName="", environment=0x5585191ad0cc) at glslang/glslang/MachineIndependent/ShaderLang.cpp:1012
__PRETTY_FUNCTION__ =
numPre = 2
numPost = 1
numTotal = 4
lengths = std::unique_ptr = {get() = 0x5585191adde0}
strings = std::unique_ptr = {get() = 0x5585191ade10}
names = std::unique_ptr = {get() = 0x5585191ade40}
sourceGuess = glslang::EShSourceHlsl
spvVersion = {spv = 65536, vulkanGlsl = 100, vulkan = 4194304, openGl = 0, vulkanRelaxed = false}
stage = EShLangFragment
source = glslang::EShSourceHlsl
userInput = {_vptr.TInputScanner = 0x5585170db028 , numSources = 1, sources = 0x5585191ade20, lengths = 0x5585191addf0, currentSource = 0, currentChar = 0, loc = 0x5585191ad170, stringBias = 0, finale = 0, logicalSourceLoc = {name = 0x0, string = 1, line = 0, column = 0}, singleLogical = false, endOfFileReached = false}
version = 500
profile = ECoreProfile
versionNotFirstToken = false
versionNotFirst = true
versionNotFound = true
goodVersion = true
versionWillBeError = true
warnVersionNotFirst = false
cachedTable = 0x5585191f8d50
symbolTable = std::unique_ptr = {get() = 0x5585191ae110}
parseContext = std::unique_ptr = {get() = 0x5585191b0150}
scanContext = {_vptr.TScanContext = 0x5585170daf70 , parseContext = @0x5585191b0150, afterType = false, afterStruct = false, field = false, afterBuffer = false, loc = {name = 0xe05059ea, string = -1054847520, line = 32546, column = -1054830400}, parserToken = 0x7ffd9d631bb4, ppToken = 0x7f22c163251a , tokenText = 0x762 , keyword = -1054682344}
preamble = "#define GL_ARB_texture_rectangle 1\n#define GL_ARB_shading_language_420pack 1\n#define GL_ARB_texture_gather 1\n#define GL_ARB_gpu_shader5 1\n#define GL_ARB_separate_shader_objects 1\n#define GL_ARB_comput"...
fullInput = {_vptr.TInputScanner = 0x5585170db028 , numSources = 4, sources = 0x5585191ade10, lengths = 0x5585191adde0, currentSource = 4, currentChar = 73, loc = 0x5585191adf90, stringBias = 2, finale = 1, logicalSourceLoc = {name = 0x0, string = 1, line = 132, column = 19}, singleLogical = false, endOfFileReached = true}
success = false
#32 0x00005585166d4c6c in (anonymous namespace)::CompileDeferred (compiler=0x5585191ad1f0, shaderStrings=0x5585191acd88, numStrings=1, inputLengths=0x0, stringNames=0x5585191acdb0, preamble=0x5585170e77b0 "", optLevel=EShOptNone, resources=0x5585177ea260 , defaultVersion=100, defaultProfile=ENoProfile, forceDefaultVersionAndProfile=false, overrideVersion=0, forwardCompatible=false, messages=88, intermediate=..., includer=..., sourceEntryPointName="", environment=0x5585191ad0cc) at glslang/glslang/MachineIndependent/ShaderLang.cpp:1318
parser = {}
#33 0x00005585166d6547 in glslang::TShader::parse (this=0x5585191ad050, builtInResources=0x5585177ea260 , defaultVersion=100, defaultProfile=ENoProfile, forceDefaultVersionAndProfile=false, forwardCompatible=false, messages=88, includer=...) at glslang/glslang/MachineIndependent/ShaderLang.cpp:1910
No locals.
#34 0x000055851661c1b8 in glslang::TShader::parse (this=0x5585191ad050, builtInResources=0x5585177ea260 , defaultVersion=100, forwardCompatible=false, messages=88, includer=...) at glslang/StandAlone/./../glslang/Public/ShaderLang.h:680
No locals.
#35 0x00005585166199ba in CompileAndLinkShaderUnits (compUnits=std::vector of length 1, capacity 1 = {...}) at glslang/StandAlone/StandAlone.cpp:1430
compUnit = @0x5585191acd80: {stage = EShLangFragment, static maxCount = 1, count = 1, text = {0x5585191add50 "float4 PSMain(float1x4 a, float1 b) : SV_TARGET { \n return mul(a, b);\n}\n"}, fileName = {"test.frag.hlsl"}, fileNameList = {0x5585191acd60 "test.frag.hlsl"}}
shader = 0x5585191ad050
intrinsicString = ""
defaultVersion = 100
it = {stage = EShLangFragment, static maxCount = 1, count = 1, text = {0x5585191add50 "float4 PSMain(float1x4 a, float1 b) : SV_TARGET { \n return mul(a, b);\n}\n"}, fileName = {"test.frag.hlsl"}, fileNameList = {0x5585191acd60 "test.frag.hlsl"}}
shaders = std::__cxx11::list = {[0] = 0x5585191ad050}
messages = 88
includer = { = {_vptr.Includer = 0x55851708bda0 }, directoryStack = std::vector of length 0, capacity 0, externalLocalDirectoryCount = 0, includedFiles = std::set with 0 elements}
sources = std::vector of length 1, capacity 1 = {"test.frag.hlsl"}
program = @0x5585191acdc0: {_vptr.TProgram = 0x5585170daeb8 , pool = 0x5585191a0c20, stages = {empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list, empty std::__cxx11::list}, intermediate = {0x0 }, newedIntermediate = {false }, infoSink = 0x5585191acfc0, reflection = 0x0, linked = false}
#36 0x000055851661a372 in CompileAndLinkShaderFiles (Worklist=...) at glslang/StandAlone/StandAlone.cpp:1592
j = 0
i = 0
compUnits = std::vector of length 1, capacity 1 = {{stage = EShLangFragment, static maxCount = 1, count = 1, text = {0x5585191add50 "float4 PSMain(float1x4 a, float1 b) : SV_TARGET { \n return mul(a, b);\n}\n"}, fileName = {"test.frag.hlsl"}, fileNameList = {0x7ffd9d632560 "test.frag.hlsl"}}}
#37 0x000055851661a962 in singleMain () at glslang/StandAlone/StandAlone.cpp:1667
workList = {_vptr.TWorklist = 0x55851708be08 , mutex = { = {_M_mutex = {__data = {__lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = '\000' , __align = 0}}, }, worklist = empty std::__cxx11::list}
#38 0x000055851661ace8 in main (argc=6, argv=0x7ffd9d6327f8) at glslang/StandAlone/StandAlone.cpp:1721
i = 0
ret = 0
iterations = 1
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the HLSL example with glslangValidator, then start in glslang/SPIRV/GlslangToSpv.cpp at createBinaryMatrixOperation() around line 6529 and trace its caller at createBinaryOperation() around line 6404. Done means the 1D vector/matrix multiplication no longer triggers the reported assertion or crashes during SPIR-V generation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.