Tested on x86_64-darwin, pushed to trunk, thanks,
Iain

--- 8< ---

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]>
---
 gcc/config/darwin.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/config/darwin.cc b/gcc/config/darwin.cc
index ba934c26402..7e822a9a852 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)
-- 
2.50.1 (Apple Git-155)

Reply via email to