From b5665cfac472edefbf45a16f726663c6709a68a9 Mon Sep 17 00:00:00 2001 From: myoungwon oh Date: Mon, 2 Dec 2024 10:02:08 +0000 Subject: [PATCH] crimson/osd/ops_executer: prevent access to null pointers caused by gcc bug This commit assigns the parameter eariler to work around a coroutine related gcc bug that causes a null pointer access. Signed-off-by: Yingxin Cheng Signed-off-by: Myoungwon Oh --- src/crimson/osd/ops_executer.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/crimson/osd/ops_executer.h b/src/crimson/osd/ops_executer.h index 94b64ccebb165..51436f19da7e9 100644 --- a/src/crimson/osd/ops_executer.h +++ b/src/crimson/osd/ops_executer.h @@ -517,14 +517,21 @@ OpsExecuter::flush_changes_n_do_ops_effects( ceph_assert(log_rit->version == osd_op_params->at_version); } + /* + * This works around the gcc bug causing the generated code to incorrectly + * execute unconditionally before the predicate. + * + * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101244 + */ + auto clone_obc = cloning_ctx + ? std::move(cloning_ctx->clone_obc) + : nullptr; auto [_submitted, _all_completed] = co_await mut_func( std::move(txn), std::move(obc), std::move(*osd_op_params), std::move(log_entries), - cloning_ctx - ? std::move(cloning_ctx->clone_obc) - : nullptr); + std::move(clone_obc)); submitted = std::move(_submitted); all_completed = std::move(_all_completed); -- 2.39.5