i386: Fix array index overflow in pr105354-2.c

Message ID 20240426090128.3722605-1-haochen.jiang@intel.com
State Committed
Commit 4a2e55b3ada20fe6457466bb687a66c8d03e056e
Headers
Series i386: Fix array index overflow in pr105354-2.c |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_gcc_build--master-arm warning Patch is already merged

Commit Message

Jiang, Haochen April 26, 2024, 9:01 a.m. UTC
  Hi all,

The array index should not be over 8 for v8hi, or it will fail
under -O0 or using -fstack-protector.

This patch aims to fix that, which is mentioned in PR110621.

Commit as obvious and backport to GCC13.

Thx,
Haochen

gcc/testsuite/ChangeLog:

	PR target/110621
	* gcc.target/i386/pr105354-2.c: As mentioned.
---
 gcc/testsuite/gcc.target/i386/pr105354-2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Uros Bizjak April 26, 2024, 9:13 a.m. UTC | #1
On Fri, Apr 26, 2024 at 11:03 AM Haochen Jiang <haochen.jiang@intel.com> wrote:
>
> Hi all,
>
> The array index should not be over 8 for v8hi, or it will fail
> under -O0 or using -fstack-protector.
>
> This patch aims to fix that, which is mentioned in PR110621.
>
> Commit as obvious and backport to GCC13.
>
> Thx,
> Haochen
>
> gcc/testsuite/ChangeLog:
>
>         PR target/110621
>         * gcc.target/i386/pr105354-2.c: As mentioned.

Please note that the ChangeLog entry gets copied into the relevant
ChangeLog file independently of the commit message. So, the above
entry will be copied to gcc/testsuite/ChangeLog without any reference
to what was mentioned.

Uros.

> ---
>  gcc/testsuite/gcc.target/i386/pr105354-2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/testsuite/gcc.target/i386/pr105354-2.c b/gcc/testsuite/gcc.target/i386/pr105354-2.c
> index b78b62e1e7e..1c592e84860 100644
> --- a/gcc/testsuite/gcc.target/i386/pr105354-2.c
> +++ b/gcc/testsuite/gcc.target/i386/pr105354-2.c
> @@ -17,7 +17,7 @@ sse2_test (void)
>        b.a[i] = i + 16;
>        res_ab.a[i] = 0;
>        exp_ab.a[i] = -1;
> -      if (i <= 8)
> +      if (i < 8)
>         {
>           c.a[i] = i;
>           d.a[i] = i + 8;
> --
> 2.31.1
>
  
Jiang, Haochen April 26, 2024, 4:16 p.m. UTC | #2
> -----Original Message-----
> From: Uros Bizjak <ubizjak@gmail.com>
> Sent: Friday, April 26, 2024 5:13 PM
> To: Jiang, Haochen <haochen.jiang@intel.com>
> Cc: gcc-patches@gcc.gnu.org; Liu, Hongtao <hongtao.liu@intel.com>
> Subject: Re: [PATCH] i386: Fix array index overflow in pr105354-2.c
> 
> On Fri, Apr 26, 2024 at 11:03 AM Haochen Jiang <haochen.jiang@intel.com>
> wrote:
> >
> > Hi all,
> >
> > The array index should not be over 8 for v8hi, or it will fail
> > under -O0 or using -fstack-protector.
> >
> > This patch aims to fix that, which is mentioned in PR110621.
> >
> > Commit as obvious and backport to GCC13.
> >
> > Thx,
> > Haochen
> >
> > gcc/testsuite/ChangeLog:
> >
> >         PR target/110621
> >         * gcc.target/i386/pr105354-2.c: As mentioned.
> 
> Please note that the ChangeLog entry gets copied into the relevant
> ChangeLog file independently of the commit message. So, the above
> entry will be copied to gcc/testsuite/ChangeLog without any reference
> to what was mentioned.
>

I see. Forget to pay attention to that ChangeLog entry. My Bad.

Thx,
Haochen
 
> Uros.
>
  

Patch

diff --git a/gcc/testsuite/gcc.target/i386/pr105354-2.c b/gcc/testsuite/gcc.target/i386/pr105354-2.c
index b78b62e1e7e..1c592e84860 100644
--- a/gcc/testsuite/gcc.target/i386/pr105354-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr105354-2.c
@@ -17,7 +17,7 @@  sse2_test (void)
       b.a[i] = i + 16;
       res_ab.a[i] = 0;
       exp_ab.a[i] = -1;
-      if (i <= 8)
+      if (i < 8)
 	{
 	  c.a[i] = i;
 	  d.a[i] = i + 8;