From 93347f5727fc787e0ab79801bc35a0cae2f4135e Mon Sep 17 00:00:00 2001 From: Fabrice Le Fessant Date: Fri, 3 Jan 2025 12:37:08 +0100 Subject: [PATCH] fix profiling bug --- cobc/typeck.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cobc/typeck.c b/cobc/typeck.c index 280fa922d..c94386ee8 100644 --- a/cobc/typeck.c +++ b/cobc/typeck.c @@ -10019,6 +10019,7 @@ build_evaluate (cb_tree subject_list, cb_tree case_list, cb_tree goto_end_label) cb_source_line = old_line; } else { + int need_end_goto = 1 ; c2 = stmt; /* Check if last statement is GO TO */ for (c3 = stmt; c3; c3 = CB_CHAIN (c3)) { @@ -10028,11 +10029,14 @@ build_evaluate (cb_tree subject_list, cb_tree case_list, cb_tree goto_end_label) } if (c3 && CB_VALUE (c3) && CB_STATEMENT_P (CB_VALUE (c3))) { c3 = CB_STATEMENT (CB_VALUE (c3))->body; - if (c3 && CB_VALUE (c3) && !CB_GOTO_P (CB_VALUE(c3))) { - /* Append the jump */ - c2 = cb_list_add (stmt, goto_end_label); + if (c3 && CB_VALUE (c3) && CB_GOTO_P (CB_VALUE(c3))) { + need_end_goto = 0 ; } } + if ( need_end_goto ){ + /* Append the jump */ + c2 = cb_list_add (stmt, goto_end_label); + } cb_emit (cb_build_if (cb_build_cond (c1), c2, NULL, STMT_WHEN)); build_evaluate (subject_list, CB_CHAIN (case_list), goto_end_label); }