From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23750 invoked by alias); 19 Apr 2011 03:23:28 -0000 Received: (qmail 23741 invoked by uid 22791); 19 Apr 2011 03:23:27 -0000 X-SWARE-Spam-Status: No, hits=-0.8 required=5.0 tests=AWL,BAYES_40,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (140.186.70.10) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 19 Apr 2011 03:23:13 +0000 Received: from eggs.gnu.org ([140.186.70.92]:60900) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1QC1Wz-0002D5-6E for gcc-patches@gnu.org; Mon, 18 Apr 2011 23:23:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QC1Wx-0007vp-5P for gcc-patches@gnu.org; Mon, 18 Apr 2011 23:23:13 -0400 Received: from mail-fx0-f41.google.com ([209.85.161.41]:51074) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QC1Ww-0007vL-W5 for gcc-patches@gnu.org; Mon, 18 Apr 2011 23:23:11 -0400 Received: by fxm18 with SMTP id 18so3918139fxm.0 for ; Mon, 18 Apr 2011 20:23:08 -0700 (PDT) Received: by 10.223.79.79 with SMTP id o15mr241536fak.16.1303183099460; Mon, 18 Apr 2011 20:18:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.81.75 with HTTP; Mon, 18 Apr 2011 20:14:19 -0700 (PDT) In-Reply-To: <1303001733.34455839@www2.webmail.us> References: <1303001733.34455839@www2.webmail.us> From: Laurynas Biveinis Date: Tue, 19 Apr 2011 07:07:00 -0000 Message-ID: Subject: Re: Fix gengtype-state string hashtable To: Nicola Pero Cc: "gcc-patches@gnu.org" , Basile STARYNKEVITCH Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.161.41 X-IsSubscribed: yes 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: 2011-04/txt/msg01482.txt.bz2 2011/4/17 Nicola Pero : > While reading GCC code, I noticed that in gengtype-state.c > the equality function in a string hashtable is set to strcmp. > > But that returns 0 (ie, false for hashtable.c) when the strings > are equal! =C2=A0I can't see how that hashtable would ever work. =C2=A0Do > we have any tests for gengtype-state ? =C2=A0Am I missing something ? :-) The gengtype state is tested during normal bootstrap these days (the state is dumped and the loaded back). After reading the code I think that this bug is causing multiple copies of the same string in the hashtable without any correctness issues, that's why we missed it. > +2011-04-17 =C2=A0Nicola Pero =C2=A0 > + > + =C2=A0 =C2=A0 =C2=A0 * gengtype-state.c (string_eq): New. > + =C2=A0 =C2=A0 =C2=A0 (read_state): Use string_eq instead of strcmp when= creating the > + =C2=A0 =C2=A0 =C2=A0 state_ident_tab. > + The patch is OK. Thanks! --=20 Laurynas