[r11-4328 Regression] FAIL: g++.dg/warn/Wsizeof-array-div2.C -std=gnu++98 (test for warnings, line 11) on Linux/x86_64

Marek Polacek polacek@redhat.com
Fri Oct 23 23:30:09 GMT 2020


On Fri, Oct 23, 2020 at 04:14:20PM -0700, sunil.k.pandey via Gcc-patches wrote:
> On Linux/x86_64,
> 
> 83f83ddfe0fe41c9b553850d4ababd5089df8332 is the first bad commit
> commit 83f83ddfe0fe41c9b553850d4ababd5089df8332
> Author: Marek Polacek <polacek@redhat.com>
> Date:   Fri Sep 11 16:19:08 2020 -0400
> 
>     c, c++: Implement -Wsizeof-array-div [PR91741]
> 
> caused
> 
> FAIL: c-c++-common/Wsizeof-array-div1.c  -std=gnu++14  (test for warnings, line 16)
> FAIL: c-c++-common/Wsizeof-array-div1.c  -std=gnu++14  (test for warnings, line 17)
> FAIL: c-c++-common/Wsizeof-array-div1.c  -std=gnu++14  (test for warnings, line 21)
> FAIL: c-c++-common/Wsizeof-array-div1.c  -std=gnu++17  (test for warnings, line 16)
> FAIL: c-c++-common/Wsizeof-array-div1.c  -std=gnu++17  (test for warnings, line 17)
> FAIL: c-c++-common/Wsizeof-array-div1.c  -std=gnu++17  (test for warnings, line 21)
> FAIL: c-c++-common/Wsizeof-array-div1.c  -std=gnu++2a  (test for warnings, line 16)
> FAIL: c-c++-common/Wsizeof-array-div1.c  -std=gnu++2a  (test for warnings, line 17)
> FAIL: c-c++-common/Wsizeof-array-div1.c  -std=gnu++2a  (test for warnings, line 21)
> FAIL: c-c++-common/Wsizeof-array-div1.c  -std=gnu++98  (test for warnings, line 16)
> FAIL: c-c++-common/Wsizeof-array-div1.c  -std=gnu++98  (test for warnings, line 17)
> FAIL: c-c++-common/Wsizeof-array-div1.c  -std=gnu++98  (test for warnings, line 21)
> FAIL: c-c++-common/Wsizeof-array-div1.c  -Wc++-compat   (test for warnings, line 16)
> FAIL: c-c++-common/Wsizeof-array-div1.c  -Wc++-compat   (test for warnings, line 17)
> FAIL: c-c++-common/Wsizeof-array-div1.c  -Wc++-compat   (test for warnings, line 21)
> FAIL: g++.dg/warn/Wsizeof-array-div2.C  -std=gnu++14  (test for warnings, line 11)
> FAIL: g++.dg/warn/Wsizeof-array-div2.C  -std=gnu++17  (test for warnings, line 11)
> FAIL: g++.dg/warn/Wsizeof-array-div2.C  -std=gnu++2a  (test for warnings, line 11)
> FAIL: g++.dg/warn/Wsizeof-array-div2.C  -std=gnu++98  (test for warnings, line 11)

Fixed thus:

>From d835608f05471e749533c756ccdd9e166b819b68 Mon Sep 17 00:00:00 2001
From: Marek Polacek <polacek@redhat.com>
Date: Fri, 23 Oct 2020 19:26:43 -0400
Subject: [PATCH] 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.
---
 gcc/testsuite/c-c++-common/Wsizeof-array-div1.c | 6 +++---
 gcc/testsuite/g++.dg/warn/Wsizeof-array-div2.C  | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

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 <https://www.viva64.com/en/examples/v706/>.
 

base-commit: 67f3791f7d133214b112bd831ff2876822c665d0
-- 
2.26.2



More information about the Gcc-regression mailing list