Fix excess warnings for mingw-w64 (LLP64)
Checks
Commit Message
I'm not fully confident if it might break other platforms. So hopefully
someone can comment on the patch.
gcc/testsuite/ChangeLog:
* c-c++-common/Wsizeof-array-div1.c: fix excess warnings.
* gcc.dg/Warray-bounds-52.c: ditto
* gcc.dg/Wstringop-overflow-62.c: ditto
* gcc.dg/attr-vector_size.c: ditto
* gcc.dg/overflow-warn-9.c: ditto
Comments?
From 209c55e5695e0124138b27057dac5329106f29be Mon Sep 17 00:00:00 2001
From: Jonathan Yong <10walls@gmail.com>
Date: Sat, 28 Jan 2023 16:49:27 +0000
Subject: [PATCH] gcc/testsuite: fix excess warnings for mingw-w64
gcc/testsuite/ChangeLog:
* c-c++-common/Wsizeof-array-div1.c: fix excess warnings.
* gcc.dg/Warray-bounds-52.c: ditto
* gcc.dg/Wstringop-overflow-62.c: ditto
* gcc.dg/attr-vector_size.c: ditto
* gcc.dg/overflow-warn-9.c: ditto
Signed-off-by: Jonathan Yong <10walls@gmail.com>
---
gcc/testsuite/c-c++-common/Wsizeof-array-div1.c | 6 +++---
gcc/testsuite/gcc.dg/Warray-bounds-52.c | 2 +-
gcc/testsuite/gcc.dg/Wstringop-overflow-62.c | 2 +-
gcc/testsuite/gcc.dg/attr-vector_size.c | 4 ++--
gcc/testsuite/gcc.dg/overflow-warn-9.c | 2 +-
5 files changed, 8 insertions(+), 8 deletions(-)
@@ -13,12 +13,12 @@ fn (int ap[])
int r = 0;
r += sizeof (arr) / sizeof (*arr);
- r += sizeof (arr) / sizeof (p); /* { dg-warning "expression does not compute" "" { target { lp64 } } } */
- r += sizeof (arr) / sizeof p; /* { dg-warning "expression does not compute" "" { target { lp64 } } } */
+ r += sizeof (arr) / sizeof (p); /* { dg-warning "expression does not compute" "" { target { ! ilp32 } } } */
+ r += sizeof (arr) / sizeof p; /* { dg-warning "expression does not compute" "" { target { ! ilp32 } } } */
r += sizeof (arr) / (sizeof p);
r += sizeof (arr) / (sizeof (p));
r += sizeof (arr2) / sizeof p;
- r += sizeof (arr2) / sizeof (int); /* { dg-warning "expression does not compute" "" { target { lp64 } } } */
+ r += sizeof (arr2) / sizeof (int); /* { dg-warning "expression does not compute" "" { target { ! ilp32 } } } */
r += sizeof (arr2) / sizeof (int *);
r += sizeof (arr2) / sizeof (short *);
r += sizeof (arr) / sizeof (int);
@@ -60,7 +60,7 @@ void ptr_idx_cst (void)
T ( 0, (int[]){ 1 });
T (+1, (int[]){ 1 }); // { dg-warning "array subscript 1 is outside array bounds of 'int\\\[1]'" }
T (INT_MIN, (int[]){ 1 }); // { dg-warning "array subscript -\[0-9\]+ is outside array bounds of 'int\\\[1]'" "lp64" { xfail ilp32 } }
- T (INT_MAX, (int[]){ 1 }); // { dg-warning "array subscript \[0-9\]+ is outside array bounds of 'int\\\[1]'" "lp64" { target lp64 } }
+ T (INT_MAX, (int[]){ 1 }); // { dg-warning "array subscript \[0-9\]+ is outside array bounds of 'int\\\[1]'" "not-ilp32" { target { ! ilp32 } } }
// { dg-warning "array subscript -1 is outside array bounds of 'int\\\[1]'" "ilp32" { target ilp32 } .-1 }
T (SIZE_MAX, (int[]){ 1 }); // { dg-warning "array subscript -?\[0-9\]+ is outside array bounds of 'int\\\[1]'" }
}
@@ -41,7 +41,7 @@ void test_min (void)
memset (q, 0, DIFF_MAX - 2);
memset (q, 0, DIFF_MAX);
// { dg-warning "writing 2147483647 bytes into a region of size 2147483646" "ilp32" { target ilp32 } .-1 }
- // { dg-warning "writing 9223372036854775807 bytes into a region of size 9223372036854775806" "lp64" { target lp64 } .-2 }
+ // { dg-warning "writing 9223372036854775807 bytes into a region of size 9223372036854775806" "not-ilp32" { target { ! ilp32 } } .-2 }
}
{
@@ -22,7 +22,7 @@ DEFVEC (extern, 30);
#if __SIZEOF_SIZE_T__ > 4
-VEC (POW2 (63)) char v63; /* { dg-error "'vector_size' attribute argument value '9223372036854775808' exceeds 9223372036854775807" "LP64" { target lp64 } } */
+VEC (POW2 (63)) char v63; /* { dg-error "'vector_size' attribute argument value '9223372036854775808' exceeds 9223372036854775807" "not-ILP32" { target { ! ilp32 } } } */
#else
@@ -41,7 +41,7 @@ void test_local_scope (void)
#if __SIZEOF_SIZE_T__ > 4
- VEC (POW2 (63)) char v63; /* { dg-error "'vector_size' attribute argument value '9223372036854775808' exceeds 9223372036854775807" "LP64" { target lp64 } } */
+ VEC (POW2 (63)) char v63; /* { dg-error "'vector_size' attribute argument value '9223372036854775808' exceeds 9223372036854775807" "not-ILP32" { target { ! ilp32 } } } */
#else
@@ -59,7 +59,7 @@ const struct Types t1 = {
.ui = UINT_MAX + 1L, /* { dg-warning "signed conversion from .long int. to .unsigned int. changes value from .4294967296. to .0." "lp64" { target lp64 } } */
.ui = UINT_MAX + 1LU, /* { dg-warning "conversion from .long unsigned int. to .unsigned int. changes value from .4294967296. to .0." "lp64" { target lp64 } } */
- .sl = LONG_MAX + 1LU, /* { dg-warning "signed conversion from .long unsigned int. to .long int. changes value from .9223372036854775808. to .-9223372036854775808." "lp64" { target lp64 } } */
+ .sl = LONG_MAX + 1LU, /* { dg-warning "signed conversion from .long unsigned int. to .long int. changes value from .9223372036854775808. to .-9223372036854775808." "not-ilp32" { target { ! ilp32 } } } */
/* { dg-warning "signed conversion from .long unsigned int. to .long int. changes value from .2147483648. to .-2147483648." "ilp32" { target ilp32 } .-1 } */
.ul = ULONG_MAX + 1LU /* there should be some warning here */
};
--
2.39.1