From: Marek Polacek Date: Fri, 23 Oct 2020 23:26:43 +0000 (-0400) Subject: testsuite: Fix -Wsizeof-array-div tests. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d835608f05471e749533c756ccdd9e166b819b68;p=gcc.git testsuite: Fix -Wsizeof-array-div tests. gcc/testsuite/ChangeLog: * c-c++-common/Wsizeof-array-div1.c: Expect certain warnings on lp64 targets only. * g++.dg/warn/Wsizeof-array-div2.C: Only run on lp64 targets. --- diff --git a/gcc/testsuite/c-c++-common/Wsizeof-array-div1.c b/gcc/testsuite/c-c++-common/Wsizeof-array-div1.c index 84d9a730cba..6e01d6c87d1 100644 --- a/gcc/testsuite/c-c++-common/Wsizeof-array-div1.c +++ b/gcc/testsuite/c-c++-common/Wsizeof-array-div1.c @@ -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" } */ - r += sizeof (arr) / sizeof p; /* { dg-warning "expression does not compute" } */ + 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); r += sizeof (arr) / (sizeof (p)); r += sizeof (arr2) / sizeof p; - r += sizeof (arr2) / sizeof (int); /* { dg-warning "expression does not compute" } */ + r += sizeof (arr2) / sizeof (int); /* { dg-warning "expression does not compute" "" { target { lp64 } } } */ r += sizeof (arr2) / sizeof (int *); r += sizeof (arr2) / sizeof (short *); r += sizeof (arr) / sizeof (int); diff --git a/gcc/testsuite/g++.dg/warn/Wsizeof-array-div2.C b/gcc/testsuite/g++.dg/warn/Wsizeof-array-div2.C index 7962c23522c..66fe72ab6c9 100644 --- a/gcc/testsuite/g++.dg/warn/Wsizeof-array-div2.C +++ b/gcc/testsuite/g++.dg/warn/Wsizeof-array-div2.C @@ -1,5 +1,5 @@ // PR c++/91741 -// { dg-do compile } +// { dg-do compile { target { lp64 } } } // { dg-options "-Wall" } // From .