http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51297

--- Comment #8 from Nathan Sidwell <nathan at acm dot org> 2011-11-24 22:12:11 
UTC ---
On 11/24/11 21:54, ebotcazou at gcc dot gnu.org wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51297
>
> --- Comment #7 from Eric Botcazou<ebotcazou at gcc dot gnu.org>  2011-11-24 
> 21:54:15 UTC ---
>> d'oh!  A fix will be right up.
>
> Thanks.  I confirm that adding if (n_names>  0) in the right places works 
> fine.

Hm, can you try the attached patch?  It avoids passing a null pointer, which is 
not permitted.  Passing zero as nmemb is permitted (7.20.5 para 1 of c99).  So 
I'm a little puzzled as to why bsearch managed to call the comparison function 
at all.  I'd like to understand if we're dealing with a weird, but legal, 
implementation, or one that's got a bug.

Reply via email to