From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6197 invoked by alias); 21 Jul 2011 10:36:33 -0000 Received: (qmail 6135 invoked by uid 22791); 21 Jul 2011 10:36:32 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 21 Jul 2011 10:36:19 +0000 From: "iains at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/47997] gcc on macosx: "ld: warning: -fwritable-strings not compatible with literal CF/NSString" X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: iains at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Thu, 21 Jul 2011 10:36:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-07/txt/msg01732.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47997 --- Comment #22 from Iain Sandoe 2011-07-21 10:36:02 UTC --- hmm, comment #21 is not the right solution ... (even if it works) ... the right solution is either (a) to handle arrays of arbitrary-sized ints in fix_string_type () (without assuming that they are whar when not explicitly set to char{,16,32}_array_type_node) or (b) to force the type of CPP_OBJC_STRING to be char{,16,32}_array_type_node as appropriate. a. might look something like: Index: gcc/c-family/c-common.c =================================================================== --- gcc/c-family/c-common.c (revision 176554) +++ gcc/c-family/c-common.c (working copy) @@ -911,6 +911,32 @@ fix_string_type (tree value) nchars = length / (TYPE_PRECISION (char32_type_node) / BITS_PER_UNIT); e_type = char32_type_node; } + else if (TREE_TYPE (value) && TREE_CODE (TREE_TYPE (value)) == ARRAY_TYPE) + { + int prec; + + if (TREE_TYPE (TREE_TYPE ((value)))) + prec = TYPE_PRECISION (TREE_TYPE (TREE_TYPE ((value)))); + else + prec = TYPE_PRECISION (wchar_type_node); + + nchars = length / (prec / BITS_PER_UNIT); + switch (prec) + { + case BITS_PER_UNIT: + e_type = char_type_node; + break; + case 16: + e_type = char16_type_node; + break; + case 32: + e_type = char32_type_node; + break; + default: + e_type = wchar_type_node; + break; + } + } else { nchars = length / (TYPE_PRECISION (wchar_type_node) / BITS_PER_UNIT); b. needs some more investigation. thoughts?