From 0acbd1979cef136cef63264056135c698971c4b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Sat, 10 Dec 2022 00:22:17 +0100 Subject: [PATCH] Ignore jumps to the end of the function when optimizing jumps. [COMPILER] * BUG: Ignore jumps to the end of the function when optimizing jumps. --- main/gbc/gbc_trans_ctrl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main/gbc/gbc_trans_ctrl.c b/main/gbc/gbc_trans_ctrl.c index 1361dd5a0..79d677285 100644 --- a/main/gbc/gbc_trans_ctrl.c +++ b/main/gbc/gbc_trans_ctrl.c @@ -453,6 +453,8 @@ void TRANS_control_exit(void) for(j = 1; j <= 4; j++) // avoid infinite loop { + if (jump->dst >= JOB->func->ncode) + break; pcode = &JOB->func->code[jump->dst]; if (!PCODE_is_jump(*pcode)) break;