diff mbox

PATCH: PR testsuite/63305: ASan reported heap-buffer-overflow in gcc.target/i386/avx256-unaligned-load{store}-7.c

Message ID 20141109175624.GA22492@lucon.org
State New
Headers show

Commit Message

H.J. Lu Nov. 9, 2014, 5:56 p.m. UTC
Hi,

I checked in this patch to fix buffer overflow in
avx256-unaligned-load-7.c and avx256-unaligned-store-7.c.


H.J.
---

Comments

H.J. Lu Nov. 9, 2014, 6:03 p.m. UTC | #1
On Sun, Nov 9, 2014 at 9:56 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Hi,
>
> I checked in this patch to fix buffer overflow in
> avx256-unaligned-load-7.c and avx256-unaligned-store-7.c.
>
>
> H.J.
> ---
> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
> index 0e469f0..e7f0b22 100644
> --- a/gcc/testsuite/ChangeLog
> +++ b/gcc/testsuite/ChangeLog
> @@ -1,3 +1,10 @@
> +2014-11-09  H.J. Lu  <hongjiu.lu@intel.com>
> +
> +       PR testsuite/63305
> +       * gcc.target/i386/avx256-unaligned-load-7.c (avx_test): Fix
> +       buffer overflow.
> +       * gcc.target/i386/avx256-unaligned-store-7.c (avx_test): Likewise.
> +
>  2014-11-09  Andreas Schwab  <schwab@linux-m68k.org>
>
>         * gcc.target/powerpc/pr51623.c: Fix implicit declarations.
> diff --git a/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c b/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c
> index 4a94e03..4c6054c 100644
> --- a/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c
> +++ b/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c
> @@ -34,7 +34,7 @@ avx_test (void)
>    cp = mp;
>    dp = lp;
>
> -  for (i = N; i >= 0; i--)
> +  for (i = N; i > 0; i--)
>      {
>        *cp++ = str;
>        *dp++ = str;
> @@ -45,13 +45,13 @@ avx_test (void)
>    cp = mp;
>    dp = lp;
>
> -  for (i = N; i >= 0; i--)
> +  for (i = N; i > 0; i--)
>      {
>        *ap++ = *cp++;
>        *bp++ = *dp++;
>      }
>
> -  for (i = N; i >= 0; i--)
> +  for (i = N; i > 0; i--)
>      {
>        if (strcmp (*--ap, "STR") != 0)
>         abort ();
> diff --git a/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c b/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c
> index 85e387a..99a0c71 100644
> --- a/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c
> +++ b/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c
> @@ -30,13 +30,13 @@ avx_test (void)
>    ap = ep;
>    bp = fp;
>
> -  for (i = N; i >= 0; i--)
> +  for (i = N; i > 0; i--)
>      {
>        *ap++ = str;
>        *bp++ = str;
>      }
>
> -  for (i = N; i >= 0; i--)
> +  for (i = N; i > 0; i--)
>      {
>        if (strcmp (*--ap, "STR") != 0)
>         abort ();

I also backported it to 4.9 branch.
diff mbox

Patch

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0e469f0..e7f0b22 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@ 
+2014-11-09  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR testsuite/63305
+	* gcc.target/i386/avx256-unaligned-load-7.c (avx_test): Fix
+	buffer overflow.
+	* gcc.target/i386/avx256-unaligned-store-7.c (avx_test): Likewise.
+
 2014-11-09  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* gcc.target/powerpc/pr51623.c: Fix implicit declarations.
diff --git a/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c b/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c
index 4a94e03..4c6054c 100644
--- a/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c
+++ b/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c
@@ -34,7 +34,7 @@  avx_test (void)
   cp = mp;
   dp = lp;
 
-  for (i = N; i >= 0; i--)
+  for (i = N; i > 0; i--)
     {
       *cp++ = str;
       *dp++ = str;
@@ -45,13 +45,13 @@  avx_test (void)
   cp = mp;
   dp = lp;
 
-  for (i = N; i >= 0; i--)
+  for (i = N; i > 0; i--)
     {
       *ap++ = *cp++;
       *bp++ = *dp++;
     }
 
-  for (i = N; i >= 0; i--)
+  for (i = N; i > 0; i--)
     {
       if (strcmp (*--ap, "STR") != 0)
 	abort ();
diff --git a/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c b/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c
index 85e387a..99a0c71 100644
--- a/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c
+++ b/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c
@@ -30,13 +30,13 @@  avx_test (void)
   ap = ep;
   bp = fp;
 
-  for (i = N; i >= 0; i--)
+  for (i = N; i > 0; i--)
     {
       *ap++ = str;
       *bp++ = str;
     }
 
-  for (i = N; i >= 0; i--)
+  for (i = N; i > 0; i--)
     {
       if (strcmp (*--ap, "STR") != 0)
 	abort ();