This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/47997] gcc on macosx: "ld: warning: -fwritable-strings not compatible with literal CF/NSString"


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47997

--- Comment #21 from Iain Sandoe <iains at gcc dot gnu.org> 2011-07-21 09:05:10 UTC ---
This is indeed a new bug - if there is to be any lengthly deliberation, please
move it to its own PR (against objective-c).

----

calling fix_string_type () on a tree that is already a STRING_CST appears to
break things.. 

(the size and unit_size fields get screwed up).

... this might be intended [i.e. we should not call the function when we
already have a STRING_CST]
(or indicate a bug elsewhere).

I am assuming the former for now.... ergo, try this:

Index: gcc/objc/objc-act.c
===================================================================
--- gcc/objc/objc-act.c (revision 176554)
+++ gcc/objc/objc-act.c (working copy)
@@ -3132,10 +3132,13 @@ 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);
-  length = TREE_STRING_LENGTH (string) - 1;
+  if (TREE_CODE (string) != STRING_CST)
+    {
+      /* Prep the string argument.  */
+      string = fix_string_type (string);
+      TREE_SET_CODE (string, STRING_CST);
+      length = TREE_STRING_LENGTH (string) - 1;
+    }

   /* The target may have different ideas on how to construct an ObjC string
      literal.  On Darwin (Mac OS X), for example, we may wish to obtain a


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]