From patchwork Wed Jul 20 18:02:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 105773 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 71EA7B6F70 for ; Thu, 21 Jul 2011 04:03:11 +1000 (EST) Received: (qmail 26431 invoked by alias); 20 Jul 2011 18:03:09 -0000 Received: (qmail 26419 invoked by uid 22791); 20 Jul 2011 18:03:07 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, NO_DNS_FOR_FROM, RP_MATCHES_RCVD, TW_CP X-Spam-Check-By: sourceware.org Received: from e3.ny.us.ibm.com (HELO e3.ny.us.ibm.com) (32.97.182.143) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 20 Jul 2011 18:02:50 +0000 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e3.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p6KHdID2024428 for ; Wed, 20 Jul 2011 13:39:18 -0400 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p6KI2lcV131866 for ; Wed, 20 Jul 2011 14:02:48 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p6KI2kBJ012637 for ; Wed, 20 Jul 2011 14:02:46 -0400 Received: from hungry-tiger.westford.ibm.com (hungry-tiger.westford.ibm.com [9.33.37.78]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p6KI2kNM012629; Wed, 20 Jul 2011 14:02:46 -0400 Received: by hungry-tiger.westford.ibm.com (Postfix, from userid 500) id 0570EF8302; Wed, 20 Jul 2011 14:02:44 -0400 (EDT) Date: Wed, 20 Jul 2011 14:02:44 -0400 From: Michael Meissner To: gcc-patches@gcc.gnu.org, dje.gcc@gmail.com Subject: [PATCH] Make rs6000 port bootstrap using G++ as 2nd/3rd stage compilers Message-ID: <20110720180244.GA12585@hungry-tiger.westford.ibm.com> Mail-Followup-To: Michael Meissner , gcc-patches@gcc.gnu.org, dje.gcc@gmail.com MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org I tried building the powerpc64-linux compiler today, and it would not bootstrap, since evidently stages 2 and 3 are built with G++ instead of C, and G++ is more strict about const pointers. This patch allows the compiler to bootstrap. Is it ok to install? 2011-07-20 Michael Meissner * config/rs6000/rs6000.c (rs6000_xcoff_strip_dollar): Rewrite to avoid warnings when GCC is built with a C++ compiler. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 176521) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -21893,8 +21893,9 @@ toc_hash_eq (const void *h1, const void const char * rs6000_xcoff_strip_dollar (const char *name) { - char *strip, *p; - int len; + char *strip; + const char *p; + size_t len, i; p = strchr (name, '$'); @@ -21902,13 +21903,11 @@ rs6000_xcoff_strip_dollar (const char *n return name; len = strlen (name); - strip = (char *) alloca (len + 1); - strcpy (strip, name); - p = strchr (strip, '$'); - while (p) + strip = XALLOCAVEC (char, len); + for (i = 0; i < len; i++) { - *p = '_'; - p = strchr (p + 1, '$'); + int ch = name[i]; + strip[i] = (ch == '$') ? '_' : ch; } return ggc_alloc_string (strip, len);