Skip to content

Commit f858ad7

Browse files
committed
Allow not terminating finally blocks
1 parent bc0c991 commit f858ad7

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

gcc/jit/jit-playback.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -2307,14 +2307,14 @@ add_try_catch (location *loc,
23072307
}
23082308

23092309
tree try_body = alloc_stmt_list ();
2310-
int i;
2310+
unsigned int i;
23112311
tree stmt;
23122312
FOR_EACH_VEC_ELT (try_block->m_stmts, i, stmt) {
23132313
append_to_statement_list (stmt, &try_body);
23142314
}
23152315

23162316
tree catch_body = alloc_stmt_list ();
2317-
int j;
2317+
unsigned int j;
23182318
tree catch_stmt;
23192319
FOR_EACH_VEC_ELT (catch_block->m_stmts, j, catch_stmt) {
23202320
append_to_statement_list (catch_stmt, &catch_body);

gcc/jit/jit-recording.cc

+3
Original file line numberDiff line numberDiff line change
@@ -4645,6 +4645,9 @@ recording::block::add_try_catch (location *loc,
46454645
// TODO: explain why we set the blocks reachable state.
46464646
try_block->m_is_reachable = true;
46474647
catch_block->m_is_reachable = true;
4648+
/* The finally block can fallthrough, so we don't require the user to terminate it. */
4649+
if (is_finally)
4650+
catch_block->m_has_been_terminated = true;
46484651
m_ctxt->record (result);
46494652
m_statements.safe_push (result);
46504653
return result;

gcc/tree-eh.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -4883,9 +4883,9 @@ pass_cleanup_eh::execute (function *fun)
48834883
clear it. This exposes cross-language inlining opportunities
48844884
and avoids references to a never defined personality routine. */
48854885
// TODO: uncomment and find out why this doesn't work.
4886-
/*if (DECL_FUNCTION_PERSONALITY (current_function_decl)
4886+
if (DECL_FUNCTION_PERSONALITY (current_function_decl)
48874887
&& function_needs_eh_personality (fun) != eh_personality_lang)
4888-
DECL_FUNCTION_PERSONALITY (current_function_decl) = NULL_TREE;*/
4888+
DECL_FUNCTION_PERSONALITY (current_function_decl) = NULL_TREE;
48894889

48904890
return ret;
48914891
}

0 commit comments

Comments
 (0)