KhronosGroup / KhronosGroup/SPIRV-Tools
Validator: unreachable loop with unreachable continue fails validation
- Dominant language
- C++
- Stars
- 1.4k
- Forks
- 709
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 28
Description
The following SPIRV contains an unreachable loop with an unreachable continue target and an unreachable merge block. It fails validation:
```
error: line 17: Back-edges (11 -> 13) can only be formed between a block and a loop header.
%11 = OpLabel
```
```asm
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %2 "main"
OpExecutionMode %2 OriginUpperLeft
OpSource ESSL 310
OpName %2 "main"
%3 = OpTypeVoid
%4 = OpTypeFunction %3
%5 = OpTypeInt 32 1
%6 = OpTypePointer Function %5
%7 = OpTypeBool
%8 = OpConstantFalse %7
%2 = OpFunction %3 None %4
%9 = OpLabel
OpBranch %10
%11 = OpLabel ; header
OpLoopMerge %12 %13 None
OpBranch %14
%13 = OpLabel ; continue
OpBranch %11
%14 = OpLabel
OpReturn
%12 = OpLabel ; merge
OpBranch %10
%10 = OpLabel
OpReturn
OpFunctionEnd
```
Contributor guide
Research direction
No source files or tests are named. Start by running the supplied SPIR-V assembly through the validator and trace how it handles the unreachable loop, continue target, merge block, and back-edge; done means this reproducer receives the intended validation result without the reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100