https://gcc.gnu.org/g:b257b8f4524d8e61040c6d988ebf3e68d784c1a7
commit r17-4694-gb257b8f4524d8e61040c6d988ebf3e68d784c1a7 Author: Iain Sandoe <[email protected]> Date: Sun Sep 27 17:10:53 2026 +0100 Darwin: Improve robustness of select_section. In select_section we need to determine if a CONSTRUCTOR initialises an Objective-C/CoreFoundation string which we do by inspecting the typename. It is possible for a typename to be passed, even if perhaps in error, with a NULL_TREE id and we should deal with that gracefully. gcc/ChangeLog: * config/darwin.cc (machopic_select_section): Do not try to inspect a typename which has no id. Signed-off-by: Iain Sandoe <[email protected]> Diff: --- gcc/config/darwin.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/config/darwin.cc b/gcc/config/darwin.cc index ba934c264022..7e822a9a8528 100644 --- a/gcc/config/darwin.cc +++ b/gcc/config/darwin.cc @@ -1839,6 +1839,11 @@ machopic_select_section (tree decl, if (TREE_CODE (name) == TYPE_DECL) name = DECL_NAME (name); + /* If the type name ID absent, this cannot be an Objective-C or Core + Foundation string. */ + if (!name) + return base_section; + if (!strcmp (IDENTIFIER_POINTER (name), "__builtin_ObjCString")) { if (flag_next_runtime)
