Skip to content

Commit e14a7de

Browse files
committed
fix s2s parsing for functions returning void
1 parent 0d37d8f commit e14a7de

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/frontend/spirv/s2s.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,9 @@ static size_t parse_spv_instruction_at(SpvParser* parser, size_t instruction_off
663663
}
664664
case SpvOpTypeFunction: {
665665
parser->defs[result].type = Typ;
666-
const Type* return_t = qualified_type_helper(a, a->config.target.scopes.bottom, get_def_type(parser, instruction[2]));
666+
Nodes return_ts = shd_unwrap_multiple_yield_types(a, get_def_type(parser, instruction[2]));
667+
assert(return_ts.count < 2);
668+
const Type* return_t = return_ts.count > 1 ? qualified_type_helper(a, a->config.target.scopes.bottom, shd_first(return_ts)) : unit_type(a);
667669
LARRAY(const Type*, param_ts, size - 3);
668670
for (size_t i = 0; i < size - 3; i++)
669671
param_ts[i] = qualified_type_helper(a, a->config.target.scopes.bottom, get_def_type(parser, instruction[3 + i]));

0 commit comments

Comments
 (0)