https://gcc.gnu.org/g:f3b51711dcbdd023e9928d866c8d32053ba520dc
commit r16-6173-gf3b51711dcbdd023e9928d866c8d32053ba520dc Author: Iain Sandoe <[email protected]> Date: Sun Dec 14 11:24:40 2025 +0000 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 <[email protected]> Diff: --- gcc/config/aarch64/aarch64.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 4c708f265ef6..8b7253b11fef 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);
