blob: 68a1fd8118500e18f1f2327224c371f19c50748f [file] [log] [blame]
/* { dg-do compile } */
/* { dg-options "-fcilkplus" } */
/* This test has no array notation components in it and thus should compile
fine without crashing. */
typedef unsigned int size_t;
typedef int (*__compar_fn_t) (const void *, const void *);
extern void *bsearch (const void *__key, const void *__base,
size_t __nmemb, size_t __size, __compar_fn_t
__compar)
__attribute__ ((__nonnull__ (1, 2, 5))) ;
extern __inline __attribute__ ((__gnu_inline__)) void *
bsearch (const void *__key, const void *__base, size_t __nmemb, size_t
__size,
__compar_fn_t __compar)
{
size_t __l, __u, __idx;
const void *__p;
int __comparison;
__l = 0;
__u = __nmemb;
while (__l < __u)
{
__idx = (__l + __u) / 2;
__p = (void *) (((const char *) __base) +
(__idx * __size));
__comparison = (*__compar) (__key,
__p);
if (__comparison < 0)
__u = __idx;
else if (__comparison > 0)
__l = __idx + 1;
else
return (void *)
__p;
}
return ((void *)0);
}