On Mon, 18 Sep 2023, Jakub Jelinek wrote:

> On Thu, Sep 14, 2023 at 01:23:13PM +0000, Richard Biener via Gcc-patches 
> wrote:
> > diff --git a/libgomp/team.c b/libgomp/team.c
> > index 54dfca8080a..e5a86de1dd0 100644
> > --- a/libgomp/team.c
> > +++ b/libgomp/team.c
> > @@ -756,8 +756,9 @@ gomp_team_start (void (*fn) (void *), void *data, 
> > unsigned nthreads,
> >        attr = &thread_attr;
> >      }
> >  
> > -  start_data = gomp_alloca (sizeof (struct gomp_thread_start_data)
> > -                       * (nthreads - i));
> > +  if (i < nthreads)
> > +    start_data = gomp_alloca (sizeof (struct gomp_thread_start_data)
> > +                         * (nthreads - i));
> >  
> >    /* Launch new threads.  */
> >    for (; i < nthreads; ++i)
> 
> Wouldn't just
>   if (i >= nthreads)
>     __builtin_unreachable ();
> do the trick as well?

I'll check and adjust to that if possible.

Richard.

> I'd prefer not to add further runtime checks here if possible.
> 
>       Jakub
> 
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

Reply via email to