On Sat, Oct 9, 2021 at 3:51 PM Kewen.Lin via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi,
>
> This patch fixes the typos introduced by commit r12-4240.
>
> The dg-warning format looks like:
>
> { dg-warning regexp [comment [{ target/xfail selector } [line] ]] }
>
> Some dg-warnings such as:
>
> { dg-warning "\\\[-Wstringop-overflow" { target { i?86-*-* x86_64-*-* } } }
>
> miss the comment field, it makes target selector not take effect.
>
> For targets which are not { i?86-*-* x86_64-*-* }, this kind of cases
> fail or pass unexpectedly.
>
> Is it ok for trunk?
LGTM, thanks.
>
> BR,
> Kewen
> ---
> gcc/testsuite/ChangeLog:
>
>         * c-c++-common/Wstringop-overflow-2.c: Add missing comment.
>         * gcc.dg/Warray-bounds-51.c: Likewise.
>         * gcc.dg/Warray-parameter-3.c: Likewise.
>         * gcc.dg/Wstringop-overflow-14.c: Likewise.
>         * gcc.dg/Wstringop-overflow-21.c: Likewise.
>         * gcc.dg/Wstringop-overflow-76.c: Likewise.
>
> -----
> diff --git a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c 
> b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c
> index 7e9da8a02cb..7d29b5f48c7 100644
> --- a/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c
> +++ b/gcc/testsuite/c-c++-common/Wstringop-overflow-2.c
> @@ -221,7 +221,7 @@ void ga1_1 (void)
>    a1_1.a[1] = 1;                // { dg-warning "\\\[-Wstringop-overflow" }
>    a1_1.a[2] = 2;                // { dg-warning "\\\[-Wstringop-overflow" }
>
> -  struct A1 a = { 0, { 1 } };   // { dg-warning "\\\[-Wstringop-overflow" { 
> target { i?86-*-* x86_64-*-* } } }
> +  struct A1 a = { 0, { 1 } };   // { dg-warning "\\\[-Wstringop-overflow" "" 
> { target { i?86-*-* x86_64-*-* } } }
>    a.a[0] = 0;
>    a.a[1] = 1;                   // { dg-warning "\\\[-Wstringop-overflow" "" 
> { xfail { i?86-*-* x86_64-*-* } } }
>    a.a[2] = 2;                   // { dg-warning "\\\[-Wstringop-overflow" "" 
> { xfail { i?86-*-* x86_64-*-* } } }
> @@ -320,7 +320,7 @@ void ga1i_1 (void)
>    a1i_1.a[1] = 1;               // { dg-warning "\\\[-Wstringop-overflow" }
>    a1i_1.a[2] = 2;               // { dg-warning "\\\[-Wstringop-overflow" }
>
> -  struct A1 a = { 0, { 1 } };   // { dg-warning "\\\[-Wstringop-overflow" { 
> target { i?86-*-* x86_64-*-* } } }
> +  struct A1 a = { 0, { 1 } };   // { dg-warning "\\\[-Wstringop-overflow" "" 
> { target { i?86-*-* x86_64-*-* } } }
>    a.a[0] = 1;
>    a.a[1] = 2;                   // { dg-warning "\\\[-Wstringop-overflow" "" 
> { xfail { i?86-*-* x86_64-*-* } } }
>    a.a[2] = 3;                   // { dg-warning "\\\[-Wstringop-overflow" "" 
> { xfail { i?86-*-* x86_64-*-* } } }
> diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-51.c 
> b/gcc/testsuite/gcc.dg/Warray-bounds-51.c
> index b0b8bdb7938..c12f1407385 100644
> --- a/gcc/testsuite/gcc.dg/Warray-bounds-51.c
> +++ b/gcc/testsuite/gcc.dg/Warray-bounds-51.c
> @@ -38,7 +38,7 @@ void test_struct_char_vla_location (void)
>    } s;
>
>    s.cvla[0] = __LINE__;
> -  s.cvla[nelts - 1] = 0; // { dg-warning "\\\[-Wstringop-overflow" { target 
> { i?86-*-* x86_64-*-* } } }
> +  s.cvla[nelts - 1] = 0; // { dg-warning "\\\[-Wstringop-overflow" "" { 
> target { i?86-*-* x86_64-*-* } } }
>    s.cvla[nelts] = 0;  // { dg-warning "\\\[-Warray-bounds" }
>
>    sink (&s);
> diff --git a/gcc/testsuite/gcc.dg/Warray-parameter-3.c 
> b/gcc/testsuite/gcc.dg/Warray-parameter-3.c
> index e2c47e1ed36..e8a269c85c6 100644
> --- a/gcc/testsuite/gcc.dg/Warray-parameter-3.c
> +++ b/gcc/testsuite/gcc.dg/Warray-parameter-3.c
> @@ -77,7 +77,7 @@ gia3 (int a[3])
>  __attribute__ ((noipa)) void
>  gcas3 (char a[static 3])
>  {
> -  a[0] = 0; a[1] = 1; a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" { 
> target { i?86-*-* x86_64-*-* } } }
> +  a[0] = 0; a[1] = 1; a[2] = 2; // { dg-warning "\\\[-Wstringop-overflow" "" 
> { target { i?86-*-* x86_64-*-* } } }
>    a[3] = 3;                   // { dg-warning "\\\[-Warray-bounds" }
>  }
>
> diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-14.c 
> b/gcc/testsuite/gcc.dg/Wstringop-overflow-14.c
> index b648f5b41b1..7ac0154fc25 100644
> --- a/gcc/testsuite/gcc.dg/Wstringop-overflow-14.c
> +++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-14.c
> @@ -35,7 +35,7 @@ void test_memcpy_cond (int i)
>  void test_int16 (void)
>  {
>    char *p = a4 + 1;
> -  *(int16_t*)p = 0;    // { dg-warning "writing 4 bytes into a region of 
> size 3" { target { i?86-*-* x86_64-*-* } } }
> +  *(int16_t*)p = 0;    // { dg-warning "writing 4 bytes into a region of 
> size 3" "" { target { i?86-*-* x86_64-*-* } } }
>    *(int16_t*)(p + 2) = 0;   // { dg-warning "writing 2 bytes into a region 
> of size 1" "" { xfail { i?86-*-* x86_64-*-* } } }
>  }
>
> diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-21.c 
> b/gcc/testsuite/gcc.dg/Wstringop-overflow-21.c
> index e88f7b47894..d88bde9c740 100644
> --- a/gcc/testsuite/gcc.dg/Wstringop-overflow-21.c
> +++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-21.c
> @@ -23,7 +23,7 @@ void test_store_zero_length (int i)
>  {
>    char a[3];
>    struct S0 *p = (struct S0*)a;
> -  p->a = 0;                         // { dg-warning 
> "\\\[-Wstringop-overflow" { target { i?86-*-* x86_64-*-* } } }
> +  p->a = 0;                         // { dg-warning 
> "\\\[-Wstringop-overflow" "" { target { i?86-*-* x86_64-*-* } } }
>    p->b[0] = 0;
>    p->b[1] = 1;                      // { dg-bogus "\\\[-Wstringop-overflow" }
>    p->b[2] = 2;                      // { dg-warning 
> "\\\[-Wstringop-overflow" "" { xfail { i?86-*-* x86_64-*-* } } }
> @@ -50,7 +50,7 @@ void test_store_flexarray (int i)
>  {
>    char a[3];
>    struct Sx *p = (struct Sx*)a;
> -  p->a = 0;                         // { dg-warning 
> "\\\[-Wstringop-overflow" { target { i?86-*-* x86_64-*-* } } }
> +  p->a = 0;                         // { dg-warning 
> "\\\[-Wstringop-overflow" "" { target { i?86-*-* x86_64-*-* } } }
>    p->b[0] = 0;
>    p->b[1] = 1;                      // { dg-bogus "\\\[-Wstringop-overflow" }
>    p->b[2] = 1;                      // { dg-warning 
> "\\\[-Wstringop-overflow" "" { xfail { i?86-*-* x86_64-*-* } } }
> diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-76.c 
> b/gcc/testsuite/gcc.dg/Wstringop-overflow-76.c
> index 30b1c9af2e8..0c7b53ccc0b 100644
> --- a/gcc/testsuite/gcc.dg/Wstringop-overflow-76.c
> +++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-76.c
> @@ -27,7 +27,7 @@ void max_a3_a5 (int i)
>       by its own warning independently of -Wstringop-overflow.  */
>    char *d = MAX (p, q);
>
> -  d[2] = 0;         // { dg-warning "writing 4 bytes into a region of size 
> 3" { target { i?86-*-* x86_64-*-* } } }
> +  d[2] = 0;         // { dg-warning "writing 4 bytes into a region of size 
> 3" "" { target { i?86-*-* x86_64-*-* } } }
>    d[3] = 0;
>    d[4] = 0;
>    d[5] = 0;         // { dg-warning "writing 1 byte into a region of size 0" 
> "" { xfail { i?86-*-* x86_64-*-* } } }
> @@ -44,7 +44,7 @@ void max_b6_b4 (int i)
>    char *q = b4 + i;
>    char *d = MAX (p, q);
>
> -  d[3] = 0;         // { dg-warning "writing 4 bytes into a region of size 
> 3" { target { i?86-*-* x86_64-*-* } } }
> +  d[3] = 0;         // { dg-warning "writing 4 bytes into a region of size 
> 3" "" { target { i?86-*-* x86_64-*-* } } }
>    d[4] = 0;
>    d[5] = 0;
>    d[6] = 0;         // { dg-warning "writing 1 byte into a region of size 0" 
> "" { xfail { i?86-*-* x86_64-*-* } } }
>


-- 
BR,
Hongtao

Reply via email to