diff mbox series

string: Add a testcase for wcsncmp with SIZE_MAX [BZ #28755]

Message ID 20220217162831.417972-1-hjl.tools@gmail.com
State New
Headers show
Series string: Add a testcase for wcsncmp with SIZE_MAX [BZ #28755] | expand

Commit Message

H.J. Lu Feb. 17, 2022, 4:28 p.m. UTC
Verify that wcsncmp (L"abc", L"abd", SIZE_MAX) == 0.  The new test fails
without

commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87
Author: Noah Goldstein <goldstein.w.n@gmail.com>
Date:   Sun Jan 9 16:02:21 2022 -0600

    x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]

and

commit 7e08db3359c86c94918feb33a1182cd0ff3bb10b
Author: Noah Goldstein <goldstein.w.n@gmail.com>
Date:   Sun Jan 9 16:02:28 2022 -0600

    x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]

This is for BZ #28755.
---
 string/test-strncmp.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Sunil Pandey Feb. 17, 2022, 6:57 p.m. UTC | #1
LGTM

Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>

On Thu, Feb 17, 2022 at 8:28 AM H.J. Lu via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> Verify that wcsncmp (L"abc", L"abd", SIZE_MAX) == 0.  The new test fails
> without
>
> commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87
> Author: Noah Goldstein <goldstein.w.n@gmail.com>
> Date:   Sun Jan 9 16:02:21 2022 -0600
>
>     x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]
>
> and
>
> commit 7e08db3359c86c94918feb33a1182cd0ff3bb10b
> Author: Noah Goldstein <goldstein.w.n@gmail.com>
> Date:   Sun Jan 9 16:02:28 2022 -0600
>
>     x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]
>
> This is for BZ #28755.
> ---
>  string/test-strncmp.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/string/test-strncmp.c b/string/test-strncmp.c
> index df7cea4068..1a87f0e73e 100644
> --- a/string/test-strncmp.c
> +++ b/string/test-strncmp.c
> @@ -445,6 +445,18 @@ check4 (void)
>    check_result (impl, s1, s2, size, exp_result);
>  }
>
> +static void
> +check5 (void)
> +{
> +  const CHAR *s1 = L ("abc");
> +  CHAR *s2 = STRDUP (s1);
> +
> +  FOR_EACH_IMPL (impl, 0)
> +    check_result (impl, s1, s2, SIZE_MAX, 0);
> +
> +  free (s2);
> +}
> +
>  static void
>  check_overflow (void)
>  {
> @@ -569,6 +581,7 @@ test_main (void)
>    check2 ();
>    check3 ();
>    check4 ();
> +  check5 ();
>
>    printf ("%23s", "");
>    FOR_EACH_IMPL (impl, 0)
> --
> 2.35.1
>
H.J. Lu Feb. 17, 2022, 7:05 p.m. UTC | #2
On Thu, Feb 17, 2022 at 10:58 AM Sunil Pandey <skpgkp2@gmail.com> wrote:
>
> LGTM
>
> Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>

I am backporting this to release branches.

> On Thu, Feb 17, 2022 at 8:28 AM H.J. Lu via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
> >
> > Verify that wcsncmp (L"abc", L"abd", SIZE_MAX) == 0.  The new test fails
> > without
> >
> > commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87
> > Author: Noah Goldstein <goldstein.w.n@gmail.com>
> > Date:   Sun Jan 9 16:02:21 2022 -0600
> >
> >     x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]
> >
> > and
> >
> > commit 7e08db3359c86c94918feb33a1182cd0ff3bb10b
> > Author: Noah Goldstein <goldstein.w.n@gmail.com>
> > Date:   Sun Jan 9 16:02:28 2022 -0600
> >
> >     x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]
> >
> > This is for BZ #28755.
> > ---
> >  string/test-strncmp.c | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> >
> > diff --git a/string/test-strncmp.c b/string/test-strncmp.c
> > index df7cea4068..1a87f0e73e 100644
> > --- a/string/test-strncmp.c
> > +++ b/string/test-strncmp.c
> > @@ -445,6 +445,18 @@ check4 (void)
> >    check_result (impl, s1, s2, size, exp_result);
> >  }
> >
> > +static void
> > +check5 (void)
> > +{
> > +  const CHAR *s1 = L ("abc");
> > +  CHAR *s2 = STRDUP (s1);
> > +
> > +  FOR_EACH_IMPL (impl, 0)
> > +    check_result (impl, s1, s2, SIZE_MAX, 0);
> > +
> > +  free (s2);
> > +}
> > +
> >  static void
> >  check_overflow (void)
> >  {
> > @@ -569,6 +581,7 @@ test_main (void)
> >    check2 ();
> >    check3 ();
> >    check4 ();
> > +  check5 ();
> >
> >    printf ("%23s", "");
> >    FOR_EACH_IMPL (impl, 0)
> > --
> > 2.35.1
> >
Noah Goldstein Feb. 17, 2022, 7:17 p.m. UTC | #3
On Thu, Feb 17, 2022 at 1:06 PM H.J. Lu via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> On Thu, Feb 17, 2022 at 10:58 AM Sunil Pandey <skpgkp2@gmail.com> wrote:
> >
> > LGTM
> >
> > Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
>
> I am backporting this to release branches.
We will also need to backport the change of target for the RTM + AVX2 versions.


>
> > On Thu, Feb 17, 2022 at 8:28 AM H.J. Lu via Libc-alpha
> > <libc-alpha@sourceware.org> wrote:
> > >
> > > Verify that wcsncmp (L"abc", L"abd", SIZE_MAX) == 0.  The new test fails
> > > without
> > >
> > > commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87
> > > Author: Noah Goldstein <goldstein.w.n@gmail.com>
> > > Date:   Sun Jan 9 16:02:21 2022 -0600
> > >
> > >     x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]
> > >
> > > and
> > >
> > > commit 7e08db3359c86c94918feb33a1182cd0ff3bb10b
> > > Author: Noah Goldstein <goldstein.w.n@gmail.com>
> > > Date:   Sun Jan 9 16:02:28 2022 -0600
> > >
> > >     x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]
> > >
> > > This is for BZ #28755.
> > > ---
> > >  string/test-strncmp.c | 13 +++++++++++++
> > >  1 file changed, 13 insertions(+)
> > >
> > > diff --git a/string/test-strncmp.c b/string/test-strncmp.c
> > > index df7cea4068..1a87f0e73e 100644
> > > --- a/string/test-strncmp.c
> > > +++ b/string/test-strncmp.c
> > > @@ -445,6 +445,18 @@ check4 (void)
> > >    check_result (impl, s1, s2, size, exp_result);
> > >  }
> > >
> > > +static void
> > > +check5 (void)
> > > +{
> > > +  const CHAR *s1 = L ("abc");
> > > +  CHAR *s2 = STRDUP (s1);
> > > +
> > > +  FOR_EACH_IMPL (impl, 0)
> > > +    check_result (impl, s1, s2, SIZE_MAX, 0);
> > > +
> > > +  free (s2);
> > > +}
> > > +
> > >  static void
> > >  check_overflow (void)
> > >  {
> > > @@ -569,6 +581,7 @@ test_main (void)
> > >    check2 ();
> > >    check3 ();
> > >    check4 ();
> > > +  check5 ();
> > >
> > >    printf ("%23s", "");
> > >    FOR_EACH_IMPL (impl, 0)
> > > --
> > > 2.35.1
> > >
>
>
>
> --
> H.J.
H.J. Lu Feb. 17, 2022, 7:22 p.m. UTC | #4
On Thu, Feb 17, 2022 at 11:17 AM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> On Thu, Feb 17, 2022 at 1:06 PM H.J. Lu via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
> >
> > On Thu, Feb 17, 2022 at 10:58 AM Sunil Pandey <skpgkp2@gmail.com> wrote:
> > >
> > > LGTM
> > >
> > > Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
> >
> > I am backporting this to release branches.
> We will also need to backport the change of target for the RTM + AVX2 versions.

Can you do that after it is landed on master branch?

Thanks.

>
> >
> > > On Thu, Feb 17, 2022 at 8:28 AM H.J. Lu via Libc-alpha
> > > <libc-alpha@sourceware.org> wrote:
> > > >
> > > > Verify that wcsncmp (L"abc", L"abd", SIZE_MAX) == 0.  The new test fails
> > > > without
> > > >
> > > > commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87
> > > > Author: Noah Goldstein <goldstein.w.n@gmail.com>
> > > > Date:   Sun Jan 9 16:02:21 2022 -0600
> > > >
> > > >     x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755]
> > > >
> > > > and
> > > >
> > > > commit 7e08db3359c86c94918feb33a1182cd0ff3bb10b
> > > > Author: Noah Goldstein <goldstein.w.n@gmail.com>
> > > > Date:   Sun Jan 9 16:02:28 2022 -0600
> > > >
> > > >     x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755]
> > > >
> > > > This is for BZ #28755.
> > > > ---
> > > >  string/test-strncmp.c | 13 +++++++++++++
> > > >  1 file changed, 13 insertions(+)
> > > >
> > > > diff --git a/string/test-strncmp.c b/string/test-strncmp.c
> > > > index df7cea4068..1a87f0e73e 100644
> > > > --- a/string/test-strncmp.c
> > > > +++ b/string/test-strncmp.c
> > > > @@ -445,6 +445,18 @@ check4 (void)
> > > >    check_result (impl, s1, s2, size, exp_result);
> > > >  }
> > > >
> > > > +static void
> > > > +check5 (void)
> > > > +{
> > > > +  const CHAR *s1 = L ("abc");
> > > > +  CHAR *s2 = STRDUP (s1);
> > > > +
> > > > +  FOR_EACH_IMPL (impl, 0)
> > > > +    check_result (impl, s1, s2, SIZE_MAX, 0);
> > > > +
> > > > +  free (s2);
> > > > +}
> > > > +
> > > >  static void
> > > >  check_overflow (void)
> > > >  {
> > > > @@ -569,6 +581,7 @@ test_main (void)
> > > >    check2 ();
> > > >    check3 ();
> > > >    check4 ();
> > > > +  check5 ();
> > > >
> > > >    printf ("%23s", "");
> > > >    FOR_EACH_IMPL (impl, 0)
> > > > --
> > > > 2.35.1
> > > >
> >
> >
> >
> > --
> > H.J.
diff mbox series

Patch

diff --git a/string/test-strncmp.c b/string/test-strncmp.c
index df7cea4068..1a87f0e73e 100644
--- a/string/test-strncmp.c
+++ b/string/test-strncmp.c
@@ -445,6 +445,18 @@  check4 (void)
   check_result (impl, s1, s2, size, exp_result);
 }
 
+static void
+check5 (void)
+{
+  const CHAR *s1 = L ("abc");
+  CHAR *s2 = STRDUP (s1);
+
+  FOR_EACH_IMPL (impl, 0)
+    check_result (impl, s1, s2, SIZE_MAX, 0);
+
+  free (s2);
+}
+
 static void
 check_overflow (void)
 {
@@ -569,6 +581,7 @@  test_main (void)
   check2 ();
   check3 ();
   check4 ();
+  check5 ();
 
   printf ("%23s", "");
   FOR_EACH_IMPL (impl, 0)