From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21560 invoked by alias); 18 Oct 2012 08:53:00 -0000 Received: (qmail 21550 invoked by uid 22791); 18 Oct 2012 08:52:59 -0000 X-SWARE-Spam-Status: No, hits=-7.8 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 18 Oct 2012 08:52:52 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9I8qpmW018254 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 18 Oct 2012 04:52:52 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9I8qoOh016990; Thu, 18 Oct 2012 04:52:51 -0400 Message-ID: <507FC362.5070906@redhat.com> Date: Thu, 18 Oct 2012 08:53:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121009 Thunderbird/16.0 MIME-Version: 1.0 To: Tom Tromey CC: gdb-patches@sourceware.org Subject: Re: RFC: fix bug in compare_breakpoints References: <87sj9c28o1.fsf@fleche.redhat.com> In-Reply-To: <87sj9c28o1.fsf@fleche.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-10/txt/msg00315.txt.bz2 On 10/17/2012 08:35 PM, Tom Tromey wrote: > I built gdb with clang today. > > This found a bunch of nits (I'll send a nit-cleanup patch later) but > also a couple real bugs. > > Here's the first one. compare_breakpoints has an invalid comparison. > > Built (with clang and gcc) and regtested (gcc only) on x86-64 F16. Eh! Shame that gcc doesn't warn on this ("comparison always false", I gather?). Sounds like something that shouldn't be hard for the compiler to detect. IWBN to have gcc PRs for these issues. > > Tom > > 2012-10-17 Tom Tromey > > * breakpoint.c (compare_breakpoints): Fix comparison. > > diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c > index bebad75..76e3e89 100644 > --- a/gdb/breakpoint.c > +++ b/gdb/breakpoint.c > @@ -11766,7 +11766,7 @@ compare_breakpoints (const void *a, const void *b) > the number 0. */ > if (ua < ub) > return -1; > - return ub > ub ? 1 : 0; > + return ua > ub ? 1 : 0; > } > > /* Delete breakpoints by address or line. */ > -- Pedro Alves