public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Xi Ruoyao <xry111@mengyan1223.wang>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Richard Sandiford <richard.sandiford@arm.com>
Subject: Re: [PATCH] vect: fix out-of-bound access in supports_vec_convert_optab_p [PR 104851]
Date: Wed, 9 Mar 2022 09:37:50 +0100	[thread overview]
Message-ID: <CAFiYyc0nxenuyUt4q58=XeD_7Oo6jKDKW8cTEW=Vu0sK6rhPCA@mail.gmail.com> (raw)
In-Reply-To: <2a4f73f067275a669c841722d66b274768d21851.camel@mengyan1223.wang>

On Wed, Mar 9, 2022 at 5:06 AM Xi Ruoyao via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> This should be obvious, OK for trunk?

OK.

> -- >8 --
>
> Calling VECTOR_MODE_P with MAX_MACHINE_MODE has caused out-of-bound
> access.
>
> gcc/
>
>         PR tree-optimization/104851
>         * optabs-query.cc (supports_vec_convert_optab_p): Fix off-by-one
>         error.
> ---
>  gcc/optabs-query.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/optabs-query.cc b/gcc/optabs-query.cc
> index 713c098ba4e..68dc679cc6a 100644
> --- a/gcc/optabs-query.cc
> +++ b/gcc/optabs-query.cc
> @@ -720,7 +720,7 @@ static bool
>  supports_vec_convert_optab_p (optab op, machine_mode mode)
>  {
>    int start = mode == VOIDmode ? 0 : mode;
> -  int end = mode == VOIDmode ? MAX_MACHINE_MODE : mode;
> +  int end = mode == VOIDmode ? MAX_MACHINE_MODE - 1 : mode;
>    for (int i = start; i <= end; ++i)
>      if (VECTOR_MODE_P ((machine_mode) i))
>        for (int j = MIN_MODE_VECTOR_INT; j < MAX_MODE_VECTOR_INT; ++j)
> --
> 2.35.1
>
>

  reply	other threads:[~2022-03-09  8:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-09  4:05 Xi Ruoyao
2022-03-09  8:37 ` Richard Biener [this message]
2022-03-09 10:57   ` Xi Ruoyao

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='CAFiYyc0nxenuyUt4q58=XeD_7Oo6jKDKW8cTEW=Vu0sK6rhPCA@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.sandiford@arm.com \
    --cc=xry111@mengyan1223.wang \
    /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).