Skip to content

Commit 93347f5

Browse files
committed
fix profiling bug
1 parent c4fbcc3 commit 93347f5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cobc/typeck.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10019,6 +10019,7 @@ build_evaluate (cb_tree subject_list, cb_tree case_list, cb_tree goto_end_label)
1001910019
cb_source_line = old_line;
1002010020

1002110021
} else {
10022+
int need_end_goto = 1 ;
1002210023
c2 = stmt;
1002310024
/* Check if last statement is GO TO */
1002410025
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)
1002810029
}
1002910030
if (c3 && CB_VALUE (c3) && CB_STATEMENT_P (CB_VALUE (c3))) {
1003010031
c3 = CB_STATEMENT (CB_VALUE (c3))->body;
10031-
if (c3 && CB_VALUE (c3) && !CB_GOTO_P (CB_VALUE(c3))) {
10032-
/* Append the jump */
10033-
c2 = cb_list_add (stmt, goto_end_label);
10032+
if (c3 && CB_VALUE (c3) && CB_GOTO_P (CB_VALUE(c3))) {
10033+
need_end_goto = 0 ;
1003410034
}
1003510035
}
10036+
if ( need_end_goto ){
10037+
/* Append the jump */
10038+
c2 = cb_list_add (stmt, goto_end_label);
10039+
}
1003610040
cb_emit (cb_build_if (cb_build_cond (c1), c2, NULL, STMT_WHEN));
1003710041
build_evaluate (subject_list, CB_CHAIN (case_list), goto_end_label);
1003810042
}

0 commit comments

Comments
 (0)