public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] tree-optimization/111294 - backwards threader PHI costing
Date: Mon, 18 Sep 2023 09:14:54 +0200	[thread overview]
Message-ID: <ZQf47oRoNlrJ5Pcx@tucnak> (raw)
In-Reply-To: <20230914132321.E17B13858C2B@sourceware.org>

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


       reply	other threads:[~2023-09-18  7:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230914132321.E17B13858C2B@sourceware.org>
2023-09-18  7:14 ` Jakub Jelinek [this message]
2023-09-18  7:51   ` Richard Biener
     [not found] <20230914132331.8D7613858CDA@sourceware.org>
2023-09-17 17:50 ` Jeff Law
2023-09-14 13:23 Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZQf47oRoNlrJ5Pcx@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).