KhronosGroup / KhronosGroup/SPIRV-Tools
Minor issue to report validation error for OpString
- Dominant language
- C++
- Stars
- 1.4k
- Forks
- 709
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 28
Description
The following code is invalid because `OpString` for `file2` shown after `OpName`.
(correct me if I am wrong)
```
; SPIR-V
; Version: 1.0
; Generator: Google spiregg; 0
; Bound: 25
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main"
OpExecutionMode %main OriginUpperLeft
OpSource HLSL 600
%file0 = OpString "file0"
%file1 = OpString "file1"
OpName %main "main"
%file2 = OpString "file2"
OpName %src_main "src.main"
OpName %bb_entry "bb.entry"
OpName %S "S"
OpMemberName %S 0 "a"
OpMemberName %S 1 "b"
OpMemberName %S 2 "c"
OpName %s "s"
OpName %T "T"
OpMemberName %T 0 "a"
OpMemberName %T 1 "b"
OpMemberName %T 2 "c"
OpName %t "t"
%void = OpTypeVoid
%3 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%bool = OpTypeBool
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%S = OpTypeStruct %v3int %bool %v2float
%T = OpTypeStruct %v3int %bool %v2float
%_ptr_Function_S = OpTypePointer Function %S
%_ptr_Function_T = OpTypePointer Function %T
%main = OpFunction %void None %3
%4 = OpLabel
%5 = OpFunctionCall %void %src_main
OpReturn
OpFunctionEnd
%src_main = OpFunction %void None %3
%bb_entry = OpLabel
%s = OpVariable %_ptr_Function_S Function
%t = OpVariable %_ptr_Function_T Function
%p = OpLoad %T %s
OpStore %t %p
OpReturn
OpFunctionEnd
```
It shows the following message:
```
error: line 9: String cannot appear in a function declaration
%4 = OpString "file2"
```
This message is not correct because `OpString "file2"` does not appear in a function declaration.
Contributor guide
Assessment
This issue has not been assessed yet.