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'd prefer not to add further runtime checks here if possible. Jakub