From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9655 invoked by alias); 26 Nov 2007 06:38:35 -0000 Received: (qmail 9647 invoked by uid 22791); 26 Nov 2007 06:38:34 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 26 Nov 2007 06:38:28 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.1) with ESMTP id lAQ6aPi4008170; Mon, 26 Nov 2007 01:36:25 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id lAQ6aP8c011177; Mon, 26 Nov 2007 01:36:25 -0500 Received: from livre.oliva.athome.lsd.ic.unicamp.br (vpn-14-104.rdu.redhat.com [10.11.14.104]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id lAQ6aNJ9014606; Mon, 26 Nov 2007 01:36:24 -0500 Received: from livre.oliva.athome.lsd.ic.unicamp.br (localhost.localdomain [127.0.0.1]) by livre.oliva.athome.lsd.ic.unicamp.br (8.14.2/8.13.8) with ESMTP id lAQ6aMeo027099; Mon, 26 Nov 2007 04:36:22 -0200 Received: (from aoliva@localhost) by livre.oliva.athome.lsd.ic.unicamp.br (8.14.2/8.13.5/Submit) id lAQ6aLNV027098; Mon, 26 Nov 2007 04:36:21 -0200 To: Mark Mitchell Cc: gcc-patches@gcc.gnu.org, dj@redhat.com Subject: Re: stabilize .gcc_except_table with or without -g References: <472F6CD4.3010408@codesourcery.com> From: Alexandre Oliva Errors-To: aoliva@oliva.athome.lsd.ic.unicamp.br Date: Mon, 26 Nov 2007 09:33:00 -0000 In-Reply-To: <472F6CD4.3010408@codesourcery.com> (Mark Mitchell's message of "Mon\, 05 Nov 2007 11\:19\:48 -0800") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2007-11/txt/msg01355.txt.bz2 --=-=-= Content-length: 793 On Nov 5, 2007, Mark Mitchell wrote: > /* Comparison function for a splay tree in which the keys are strings. > K1 and K2 have the dynamic type "const char *". Returns <0, 0, > or >0 to indicate whether K1 is less than, equal to, or greater > than K2, respectively. */ > probably, we do. In the body of the function, you could write: > /* We use strcmp, rather than just comparing pointers, so that the > sort order will not depend on the host system. */ > If you leave the assertion in, you definitely should comment: > /* The strings are always those from IDENTIFIER_NODEs, and, therefore, > we should never have two copies of the same string. */ > The patch is OK with those changes. Thanks, here's what I'm checking in: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=gcc-stabilize-dw2-force-const-mem.patch Content-length: 1772 for gcc/ChangeLog from Alexandre Oliva * dwarf2asm.c (splay_tree_compare_strings): New function. (dw2_force_const_mem): Use it. Index: gcc/dwarf2asm.c =================================================================== --- gcc/dwarf2asm.c.orig 2007-11-25 03:04:19.000000000 -0200 +++ gcc/dwarf2asm.c 2007-11-25 03:31:43.000000000 -0200 @@ -701,6 +701,31 @@ static GTY(()) int dw2_const_labelno; # define USE_LINKONCE_INDIRECT 0 #endif +/* Comparison function for a splay tree in which the keys are strings. + K1 and K2 have the dynamic type "const char *". Returns <0, 0, or + >0 to indicate whether K1 is less than, equal to, or greater than + K2, respectively. */ + +static int +splay_tree_compare_strings (splay_tree_key k1, splay_tree_key k2) +{ + const char *s1 = (const char *)k1; + const char *s2 = (const char *)k2; + int ret; + + if (s1 == s2) + return 0; + + ret = strcmp (s1, s2); + + /* The strings are always those from IDENTIFIER_NODEs, and, + therefore, we should never have two copies of the same + string. */ + gcc_assert (ret); + + return ret; +} + /* Put X, a SYMBOL_REF, in memory. Return a SYMBOL_REF to the allocated memory. Differs from force_const_mem in that a single pool is used for the entire unit of translation, and the memory is not guaranteed to be @@ -715,7 +740,9 @@ dw2_force_const_mem (rtx x, bool public) tree decl; if (! indirect_pool) - indirect_pool = splay_tree_new_ggc (splay_tree_compare_pointers); + /* We use strcmp, rather than just comparing pointers, so that the + sort order will not depend on the host system. */ + indirect_pool = splay_tree_new_ggc (splay_tree_compare_strings); gcc_assert (GET_CODE (x) == SYMBOL_REF); --=-=-= Content-length: 249 -- Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/ FSF Latin America Board Member http://www.fsfla.org/ Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org} Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org} --=-=-=--