mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-13 00:26:00 +00:00
ast: Fix nullptr deref in Variable::info_to_str
Varaibles can infer types now, in which case the type_ field is null. Fixed: chromium:1221120 Change-Id: I0cb2a6a2e8128c56625f48940cf73cf4cadb22ce Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/55252 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
def7313523
commit
4d94eee072
@ -85,7 +85,10 @@ void Variable::info_to_str(const sem::Info& sem,
|
|||||||
make_indent(out, indent);
|
make_indent(out, indent);
|
||||||
out << declared_access_ << std::endl;
|
out << declared_access_ << std::endl;
|
||||||
make_indent(out, indent);
|
make_indent(out, indent);
|
||||||
out << type_->type_name() << std::endl;
|
if (type_) {
|
||||||
|
out << type_->type_name();
|
||||||
|
}
|
||||||
|
out << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Variable::constructor_to_str(const sem::Info& sem,
|
void Variable::constructor_to_str(const sem::Info& sem,
|
||||||
|
2
test/bug/chromium/1221120.wgsl
Normal file
2
test/bug/chromium/1221120.wgsl
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
let
|
||||||
|
H=1;
|
6
test/bug/chromium/1221120.wgsl.expected.hlsl
Normal file
6
test/bug/chromium/1221120.wgsl.expected.hlsl
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void unused_entry_point() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const int H = 1;
|
4
test/bug/chromium/1221120.wgsl.expected.msl
Normal file
4
test/bug/chromium/1221120.wgsl.expected.msl
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
constant int H = 1;
|
19
test/bug/chromium/1221120.wgsl.expected.spvasm
Normal file
19
test/bug/chromium/1221120.wgsl.expected.spvasm
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
; SPIR-V
|
||||||
|
; Version: 1.3
|
||||||
|
; Generator: Google Tint Compiler; 0
|
||||||
|
; Bound: 7
|
||||||
|
; Schema: 0
|
||||||
|
OpCapability Shader
|
||||||
|
OpMemoryModel Logical GLSL450
|
||||||
|
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
|
||||||
|
OpExecutionMode %unused_entry_point LocalSize 1 1 1
|
||||||
|
OpName %H "H"
|
||||||
|
OpName %unused_entry_point "unused_entry_point"
|
||||||
|
%int = OpTypeInt 32 1
|
||||||
|
%H = OpConstant %int 1
|
||||||
|
%void = OpTypeVoid
|
||||||
|
%3 = OpTypeFunction %void
|
||||||
|
%unused_entry_point = OpFunction %void None %3
|
||||||
|
%6 = OpLabel
|
||||||
|
OpReturn
|
||||||
|
OpFunctionEnd
|
1
test/bug/chromium/1221120.wgsl.expected.wgsl
Normal file
1
test/bug/chromium/1221120.wgsl.expected.wgsl
Normal file
@ -0,0 +1 @@
|
|||||||
|
let H = 1;
|
Loading…
x
Reference in New Issue
Block a user