Skip to content

Commit

Permalink
fix profiling bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lefessan committed Jan 3, 2025
1 parent c4fbcc3 commit 93347f5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cobc/typeck.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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);
}
Expand Down

0 comments on commit 93347f5

Please sign in to comment.