This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: fix bug in compare_breakpoints


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  <tromey@redhat.com>
> 
> 	* 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]