http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47997
--- Comment #23 from Iain Sandoe <iains at gcc dot gnu.org> 2011-07-21 14:52:26 UTC --- OK, done some more debugging .... so one can't call fix_string_type () twice on the same string and get a sensible result... ... the determination of the string type by equating to one of the global_tree nodes is broken on the second call since the first call overwrites the tree type: code fragment from fix_string_type (): i_type = build_index_type (size_int (nchars - 1)); a_type = build_array_type (e_type, i_type); if (c_dialect_cxx() || warn_write_strings) a_type = c_build_qualified_type (a_type, TYPE_QUAL_CONST); TREE_TYPE (value) = a_type; === So either this is wrong - or we need some way to know that fix_string_type has already been called (by lex_string()). in the meantime - this just avoids making the second call, because I can't see that there's any case in which objc_build_string_object () is called without a string from lex_string ()? (grep suggests not). thus; assuming that fix_string_type () is behaving as expected, the following is a fix : Index: gcc/objc/objc-act.c =================================================================== --- gcc/objc/objc-act.c (revision 176554) +++ gcc/objc/objc-act.c (working copy) @@ -3132,9 +3132,8 @@ objc_build_string_object (tree string) struct string_descriptor *desc, key; void **loc; - /* Prep the string argument. */ - string = fix_string_type (string); - TREE_SET_CODE (string, STRING_CST); + gcc_checking_assert (TREE_CODE (string) == STRING_CST); + length = TREE_STRING_LENGTH (string) - 1; /* The target may have different ideas on how to construct an ObjC string