From: Iain Sandoe Date: Sun, 14 Dec 2025 11:24:40 +0000 (+0000) Subject: aarch64: Make the test for available cached PCS data more robust. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3b51711dcbdd023e9928d866c8d32053ba520dc;p=thirdparty%2Fgcc.git aarch64: Make the test for available cached PCS data more robust. When we are emitting MI thunks, it can be the case that the target function of the thunk has already been compiled, and considered complete, with at least part of the relevant data freed. The deal with this, we amend the test for the availability of the cached PCS value to check for the presence of both the cfun and the machine content. Since these functions are in a hot code path, use gcc_checking_assert(). gcc/ChangeLog: * config/aarch64/aarch64.cc (aarch64_function_abi): Use checking assert. (aarch64_fndecl_abi): Test for the availability of the machine content before trying to look up the cached PCS. Use a checking assert. Signed-off-by: Iain Sandoe --- diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 4c708f265ef..8b7253b11fe 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -742,7 +742,7 @@ aarch64_merge_string_arguments (tree args, tree old_attr, static arm_pcs aarch64_function_abi (struct function *fun) { - gcc_assert (fun); + gcc_checking_assert (fun); if (fun->machine->pcs == ARM_PCS_UNKNOWN) fun->machine->pcs = arm_pcs (fndecl_abi (fun->decl).id ()); @@ -755,9 +755,9 @@ aarch64_function_abi (struct function *fun) static arm_pcs aarch64_fndecl_abi (tree fn) { - gcc_assert (TREE_CODE (fn) == FUNCTION_DECL); + gcc_checking_assert (TREE_CODE (fn) == FUNCTION_DECL); struct function *fun = DECL_STRUCT_FUNCTION (fn); - if (!fun) + if (!fun || !fun->machine) return arm_pcs (fndecl_abi (fn).id ()); return aarch64_function_abi (fun);