diff options
Diffstat (limited to 'gcc/cp/coroutines.cc')
-rw-r--r-- | gcc/cp/coroutines.cc | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc index a620996..5815a8c 100644 --- a/gcc/cp/coroutines.cc +++ b/gcc/cp/coroutines.cc @@ -2865,8 +2865,8 @@ find_any_await (tree *stmt, int *dosub, void *d) if (TREE_CODE (*stmt) == CO_AWAIT_EXPR) { *dosub = 0; /* We don't need to consider this any further. */ - tree **p = (tree **) d; - *p = stmt; + if (d) + *(tree **)d = stmt; return *stmt; } return NULL_TREE; @@ -3116,7 +3116,9 @@ flatten_await_stmt (var_nest_node *n, hash_set<tree> *promoted, bool already_present = promoted->add (var); gcc_checking_assert (!already_present); tree inner = TARGET_EXPR_INITIAL (init); - gcc_checking_assert (TREE_CODE (inner) != COND_EXPR); + gcc_checking_assert + (TREE_CODE (inner) != COND_EXPR + || !cp_walk_tree (&inner, find_any_await, nullptr, nullptr)); init = cp_build_modify_expr (input_location, var, INIT_EXPR, init, tf_warning_or_error); /* Simplify for the case that we have an init containing the temp @@ -4089,17 +4091,7 @@ analyze_fn_parms (tree orig, hash_map<tree, param_info> *param_uses) } parm.field_id = name; if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (parm.frame_type)) - { - char *buf = xasprintf ("_Coro_q%u_%s_live", parm_num, - DECL_NAME (arg) ? IDENTIFIER_POINTER (name) - : "__unnamed"); - parm.guard_var - = coro_build_artificial_var (UNKNOWN_LOCATION, get_identifier (buf), - boolean_type_node, orig, - boolean_false_node); - free (buf); - parm.trivial_dtor = false; - } + parm.trivial_dtor = false; else parm.trivial_dtor = true; } @@ -4944,7 +4936,7 @@ cp_coroutine_transform::build_ramp_function () tree frame_cleanup = push_stmt_list (); tree do_fr_cleanup = build1_loc (loc, TRUTH_NOT_EXPR, boolean_type_node, iarc_x); - do_fr_cleanup = build2_loc (loc, TRUTH_AND_EXPR, boolean_type_node, + do_fr_cleanup = build2_loc (loc, TRUTH_ANDIF_EXPR, boolean_type_node, coro_before_return, do_fr_cleanup); r = build3 (COND_EXPR, void_type_node, do_fr_cleanup, delete_frame_call, void_node); @@ -5036,7 +5028,7 @@ cp_coroutine_transform::build_ramp_function () tree do_cleanup = build1_loc (loc, TRUTH_NOT_EXPR, boolean_type_node, iarc_x); do_cleanup - = build2_loc (loc, TRUTH_AND_EXPR, boolean_type_node, + = build2_loc (loc, TRUTH_ANDIF_EXPR, boolean_type_node, coro_before_return, do_cleanup); r = build3_loc (loc, COND_EXPR, void_type_node, do_cleanup, parm.fr_copy_dtor, void_node); @@ -5096,7 +5088,7 @@ cp_coroutine_transform::build_ramp_function () tree promise_cleanup = push_stmt_list (); tree do_cleanup = build1_loc (loc, TRUTH_NOT_EXPR, boolean_type_node, iarc_x); - do_cleanup = build2_loc (loc, TRUTH_AND_EXPR, boolean_type_node, + do_cleanup = build2_loc (loc, TRUTH_ANDIF_EXPR, boolean_type_node, coro_before_return, do_cleanup); r = build3 (COND_EXPR, void_type_node, do_cleanup, promise_dtor, void_node); |