public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Alex Coplan <acoplan@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/morello)] coroutines: Fix ICEs with capability comparisons Date: Fri, 20 May 2022 12:34:06 +0000 (GMT) [thread overview] Message-ID: <20220520123406.75FA53857374@sourceware.org> (raw) https://gcc.gnu.org/g:68c1db55253b24240615350f80479bc20bc6cc03 commit 68c1db55253b24240615350f80479bc20bc6cc03 Author: Alex Coplan <alex.coplan@arm.com> Date: Wed Mar 16 17:10:03 2022 +0000 coroutines: Fix ICEs with capability comparisons When lowering __builtin_coro_done we were emitting a direct comparison of capabilities: this change uses the new gimple_drop_capability to compare address values instead. Similarly, we fix up morph_fn_to_coro to avoid performing invalid operations on capabilities. gcc/ChangeLog: * coroutine-passes.cc (lower_coro_builtin): Fix null check to compare address values. gcc/cp/ChangeLog: * coroutines.cc (morph_fn_to_coro): Fix capability comparison. Diff: --- gcc/coroutine-passes.cc | 7 ++++++- gcc/cp/coroutines.cc | 7 +++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gcc/coroutine-passes.cc b/gcc/coroutine-passes.cc index d032a392ce6..325c5e75f27 100644 --- a/gcc/coroutine-passes.cc +++ b/gcc/coroutine-passes.cc @@ -164,8 +164,13 @@ lower_coro_builtin (gimple_stmt_iterator *gsi, bool *handled_ops_p, tree d_ptr_tmp = make_ssa_name (ptr_type_node); gassign *get_dptr = gimple_build_assign (d_ptr_tmp, indirect); gsi_insert_before (gsi, get_dptr, GSI_SAME_STMT); + + gimple_seq seq = NULL; + d_ptr_tmp = gimple_drop_capability (&seq, d_ptr_tmp); + gsi_insert_seq_before (gsi, seq, GSI_SAME_STMT); + tree done = fold_build2 (EQ_EXPR, boolean_type_node, d_ptr_tmp, - null_pointer_node); + fold_drop_capability (null_pointer_node)); gassign *get_res = gimple_build_assign (lhs, done); gsi_replace (gsi, get_res, true); *handled_ops_p = true; diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc index e89a71de1a1..bc7086253b5 100644 --- a/gcc/cp/coroutines.cc +++ b/gcc/cp/coroutines.cc @@ -4356,8 +4356,11 @@ morph_fn_to_coro (tree orig, tree *resumer, tree *destroyer) gcc_checking_assert (same_type_p (fn_return_type, TREE_TYPE (grooaf))); tree if_stmt = begin_if_stmt (); - tree cond = build1 (CONVERT_EXPR, coro_frame_ptr, integer_zero_node); - cond = build2 (EQ_EXPR, boolean_type_node, coro_fp, cond); + tree coro_fp_addr = drop_capability (coro_fp); + tree cond = build2 (EQ_EXPR, + boolean_type_node, + coro_fp_addr, + build_zero_cst (TREE_TYPE (coro_fp_addr))); finish_if_stmt_cond (cond, if_stmt); if (VOID_TYPE_P (fn_return_type)) {
reply other threads:[~2022-05-20 12:34 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220520123406.75FA53857374@sourceware.org \ --to=acoplan@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).