Skip to content

Commit 561b4ca

Browse files
committed
Allow not terminating finally blocks
1 parent 8281be4 commit 561b4ca

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

gcc/jit/jit-playback.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,14 +2132,14 @@ add_try_catch (location *loc,
21322132
}
21332133

21342134
tree try_body = alloc_stmt_list ();
2135-
int i;
2135+
unsigned int i;
21362136
tree stmt;
21372137
FOR_EACH_VEC_ELT (try_block->m_stmts, i, stmt) {
21382138
append_to_statement_list (stmt, &try_body);
21392139
}
21402140

21412141
tree catch_body = alloc_stmt_list ();
2142-
int j;
2142+
unsigned int j;
21432143
tree catch_stmt;
21442144
FOR_EACH_VEC_ELT (catch_block->m_stmts, j, catch_stmt) {
21452145
append_to_statement_list (catch_stmt, &catch_body);

gcc/jit/jit-recording.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4541,6 +4541,9 @@ recording::block::add_try_catch (location *loc,
45414541
// TODO: explain why we set the blocks reachable state.
45424542
try_block->m_is_reachable = true;
45434543
catch_block->m_is_reachable = true;
4544+
/* The finally block can fallthrough, so we don't require the user to terminate it. */
4545+
if (is_finally)
4546+
catch_block->m_has_been_terminated = true;
45444547
m_ctxt->record (result);
45454548
m_statements.safe_push (result);
45464549
return result;

0 commit comments

Comments
 (0)