* [PATCH] vect: fix out-of-bound access in supports_vec_convert_optab_p [PR 104851]
@ 2022-03-09 4:05 Xi Ruoyao
2022-03-09 8:37 ` Richard Biener
0 siblings, 1 reply; 3+ messages in thread
From: Xi Ruoyao @ 2022-03-09 4:05 UTC (permalink / raw)
To: gcc-patches; +Cc: Richard Sandiford
This should be obvious, OK for trunk?
-- >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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] vect: fix out-of-bound access in supports_vec_convert_optab_p [PR 104851]
2022-03-09 4:05 [PATCH] vect: fix out-of-bound access in supports_vec_convert_optab_p [PR 104851] Xi Ruoyao
@ 2022-03-09 8:37 ` Richard Biener
2022-03-09 10:57 ` Xi Ruoyao
0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2022-03-09 8:37 UTC (permalink / raw)
To: Xi Ruoyao; +Cc: GCC Patches, Richard Sandiford
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
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] vect: fix out-of-bound access in supports_vec_convert_optab_p [PR 104851]
2022-03-09 8:37 ` Richard Biener
@ 2022-03-09 10:57 ` Xi Ruoyao
0 siblings, 0 replies; 3+ messages in thread
From: Xi Ruoyao @ 2022-03-09 10:57 UTC (permalink / raw)
To: Richard Biener; +Cc: GCC Patches, Richard Sandiford
On Wed, 2022-03-09 at 09:37 +0100, Richard Biener wrote:
> 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.
Committed r12-7559.
> > -- >8 --
> >
> > Calling VECTOR_MODE_P with MAX_MACHINE_MODE has caused out-of-bound
> > access.
/* snip */
> > - int end = mode == VOIDmode ? MAX_MACHINE_MODE : mode;
> > + int end = mode == VOIDmode ? MAX_MACHINE_MODE - 1 : mode;
--
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-09 10:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-09 4:05 [PATCH] vect: fix out-of-bound access in supports_vec_convert_optab_p [PR 104851] Xi Ruoyao
2022-03-09 8:37 ` Richard Biener
2022-03-09 10:57 ` Xi Ruoyao
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).