From 211677e2c2502602272a3115d75a3a0fe4d785c7 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Wed, 18 Jan 2023 09:37:30 +0300 Subject: [PATCH] Add check for SWITCH targets --- ir_check.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ir_check.c b/ir_check.c index 7891e33..2bc16ff 100644 --- a/ir_check.c +++ b/ir_check.c @@ -248,6 +248,10 @@ bool ir_check(ir_ctx *ctx) switch (insn->op) { case IR_SWITCH: /* may have many successors */ + if (use_list->count < 1) { + fprintf(stderr, "ir_base[%d].op (SWITCH) must have at least 1 succesor (%d)\n", i, use_list->count); + ok = 0; + } break; case IR_IF: if (use_list->count != 2) {