aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-01-03 09:05:31 -0800
committerJason Ekstrand <[email protected]>2018-01-08 14:57:44 -0800
commit986303cb928f1de3297c3f52a8ea52971e222472 (patch)
tree2de45243858ebbcdd1537ebfada23b2494b005c1 /src/compiler
parent70f588778c828aeb33277d35140f57d8fbeaca4a (diff)
spirv: Require a storage type for OpStore destinations
This rules out things such as trying to store a pointer to a local variable. Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/spirv/vtn_variables.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 2b3b3405e4d..399860b8085 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -2009,6 +2009,10 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
struct vtn_pointer *dest = dest_val->pointer;
struct vtn_value *src_val = vtn_untyped_value(b, w[2]);
+ /* OpStore requires us to actually have a storage type */
+ vtn_fail_if(dest->type->type == NULL,
+ "Invalid destination type for OpStore");
+
vtn_fail_if(dest_val->type->deref != src_val->type,
"Value and pointer types of OpStore do not match");