[PATCH] avoid issuing -Warray-bounds during folding (PR 88800)

Martin Sebor msebor@gmail.com
Sat Jan 19 00:03:00 GMT 2019


On 1/18/19 5:24 AM, Rainer Orth wrote:
> Hi Christophe,
> 
>> After your commit (r268037), I'm seeing excess errors on some arm targets:
>> FAIL: c-c++-common/Wrestrict.c  -Wc++-compat  (test for excess errors)
>> Excess errors:
>> /gcc/testsuite/c-c++-common/Wrestrict.c:195:3: warning: 'memcpy'
>> accessing 4 bytes at offsets [2, 3] and 0 overlaps between 1 and 2
>> bytes at offset [2, 3] [-Wrestrict]
>> /gcc/testsuite/c-c++-common/Wrestrict.c:202:3: warning: 'memcpy'
>> accessing 4 bytes at offsets [2, 3] and 0 overlaps between 1 and 2
>> bytes at offset [2, 3] [-Wrestrict]
>> /gcc/testsuite/c-c++-common/Wrestrict.c:207:3: warning: 'memcpy'
>> accessing 4 bytes at offsets [2, 3] and 0 overlaps between 1 and 2
>> bytes at offset [2, 3] [-Wrestrict]
> 
> I'm seeing the same on sparc-sun-solaris2.*, both 32 and 64-bit.
> Test results for x86_64-w64-mingw32 and ia64-suse-linux-gnu show the same
> failure.
> 
> Besides (and probably caused by the same revision), I now get
> 
> +XPASS: c-c++-common/Warray-bounds-3.c  -std=gnu++14 bug  (test for warnings, line 161)
> +XPASS: c-c++-common/Warray-bounds-3.c  -std=gnu++17 bug  (test for warnings, line 161)
> +XPASS: c-c++-common/Warray-bounds-3.c  -std=gnu++98 bug  (test for warnings, line 161)
> 
> +XPASS: c-c++-common/Warray-bounds-3.c  -Wc++-compat  bug  (test for warnings, line 161)
> 
> which is also seen on ia64-suse-linux-gnu.

I think this is the same problem as the one on arm.  The bigger patch
I posted should take care of it as well.

Martin

Index: gcc/testsuite/c-c++-common/Warray-bounds-3.c
===================================================================
--- gcc/testsuite/c-c++-common/Warray-bounds-3.c	(revision 268082)
+++ gcc/testsuite/c-c++-common/Warray-bounds-3.c	(working copy)
@@ -158,7 +158,7 @@ void test_memcpy_overflow (char *d, const char *s,
       but known access size is detected.  This works except with small
       sizes that are powers of 2 due to bug .  */
    T (char, 1, arr + SR (DIFF_MAX - 1, DIFF_MAX), s, 1);
-  T (char, 1, arr + SR (DIFF_MAX - 1, DIFF_MAX), s, 2);  /* { 
dg-warning "pointer overflow between offset \\\[\[0-9\]+, \[0-9\]+] and 
size 2 accessing array " "bug " { xfail *-*-* } } */
+  T (char, 1, arr + SR (DIFF_MAX - 1, DIFF_MAX), s, 2);  /* { 
dg-warning "pointer overflow between offset \\\[\[0-9\]+, \[0-9\]+] and 
size 2 accessing array " "bug " { xfail fold_memcpy_2 } } */
    T (char, 1, arr + SR (DIFF_MAX - 2, DIFF_MAX), s, 3);  /* { 
dg-warning "pointer overflow between offset \\\[\[0-9\]+, \[0-9\]+] and 
size 3 accessing array " "memcpy" } */
    T (char, 1, arr + SR (DIFF_MAX - 4, DIFF_MAX), s, 5);  /* { 
dg-warning "pointer overflow between offset \\\[\[0-9\]+, \[0-9\]+] and 
size 5 accessing array " "memcpy" } */
  }



More information about the Gcc-patches mailing list