From 1947f7fb808726d7c97c211180a6d03bff58b15b Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 1 Mar 2020 22:55:27 -0600 Subject: [PATCH] d3dcompiler: Don't set the node type for return instructions. Essentially just because it doesn't make sense to do so; a return instruction is not an expression usable as a source to other instructions. Signed-off-by: Zebediah Figura Signed-off-by: Matteo Bruni Signed-off-by: Alexandre Julliard --- dlls/d3dcompiler_43/hlsl.y | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y index 34adab2855b..3d04677f2ec 100644 --- a/dlls/d3dcompiler_43/hlsl.y +++ b/dlls/d3dcompiler_43/hlsl.y @@ -483,6 +483,7 @@ static struct hlsl_ir_swizzle *get_swizzle(struct hlsl_ir_node *value, const cha static struct hlsl_ir_jump *new_return(struct hlsl_ir_node *value, struct source_location loc) { + struct hlsl_type *return_type = hlsl_ctx.cur_function->return_type; struct hlsl_ir_jump *jump = d3dcompiler_alloc(sizeof(*jump)); if (!jump) { @@ -492,16 +493,15 @@ static struct hlsl_ir_jump *new_return(struct hlsl_ir_node *value, struct source jump->node.type = HLSL_IR_JUMP; jump->node.loc = loc; jump->type = HLSL_IR_JUMP_RETURN; - jump->node.data_type = hlsl_ctx.cur_function->return_type; if (value) { - if (!(jump->return_value = implicit_conversion(value, jump->node.data_type, &loc))) + if (!(jump->return_value = implicit_conversion(value, return_type, &loc))) { d3dcompiler_free(jump); return NULL; } } - else if (jump->node.data_type->base_type != HLSL_TYPE_VOID) + else if (return_type->base_type != HLSL_TYPE_VOID) { hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR, "non-void function must return a value");