Hi! On 2023-06-15T08:50:59+0800, "haochen.jiang via Gcc-patches" <gcc-patches@gcc.gnu.org> wrote: > On Linux/x86_64,
Actually: generally... > 9c03391ba447ff86038d6a34c90ae737c3915b5f is the first bad commit > commit 9c03391ba447ff86038d6a34c90ae737c3915b5f > Author: Thomas Schwinge <tho...@codesourcery.com> > Date: Wed Jun 7 16:24:26 2023 +0200 > > Tighten 'dg-warning' alternatives in > 'c-c++-common/Wfree-nonheap-object{,-2,-3}.c' > > caused > > FAIL: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++14 (test for excess > errors) > FAIL: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++14 (test for > warnings, line 45) > FAIL: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++17 (test for excess > errors) > FAIL: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++17 (test for > warnings, line 45) > FAIL: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++20 (test for excess > errors) > FAIL: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++20 (test for > warnings, line 45) > FAIL: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++98 (test for excess > errors) > FAIL: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++98 (test for > warnings, line 45) Indeed. Sorry -- not sure how that escaped my testing. I already did have the fix in a different Git commit (but not in my testing build). Pushed to master branch commit df071fbd467f0cb3711119ef41d74792fc5e6c8c "Fix 'dg-warning' in 'c-c++-common/Wfree-nonheap-object-3.c' for C++", see attached. Grüße Thomas > with GCC configured with > > ../../gcc/configure > --prefix=/export/users/haochenj/src/gcc-bisect/master/master/r14-1805/usr > --enable-clocale=gnu --with-system-zlib --with-demangler-in-ld > --with-fpmath=sse --enable-languages=c,c++,fortran --enable-cet --without-isl > --enable-libmpx x86_64-linux --disable-bootstrap > > To reproduce: > > $ cd {build_dir}/gcc && make check > RUNTESTFLAGS="dg.exp=c-c++-common/Wfree-nonheap-object-3.c > --target_board='unix{-m32}'" > $ cd {build_dir}/gcc && make check > RUNTESTFLAGS="dg.exp=c-c++-common/Wfree-nonheap-object-3.c > --target_board='unix{-m32\ -march=cascadelake}'" > $ cd {build_dir}/gcc && make check > RUNTESTFLAGS="dg.exp=c-c++-common/Wfree-nonheap-object-3.c > --target_board='unix{-m64}'" > $ cd {build_dir}/gcc && make check > RUNTESTFLAGS="dg.exp=c-c++-common/Wfree-nonheap-object-3.c > --target_board='unix{-m64\ -march=cascadelake}'" > > (Please do not reply to this email, for question about this report, contact > me at haochen dot jiang at intel.com) ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
>From df071fbd467f0cb3711119ef41d74792fc5e6c8c Mon Sep 17 00:00:00 2001 From: Thomas Schwinge <tho...@codesourcery.com> Date: Wed, 7 Jun 2023 17:12:01 +0200 Subject: [PATCH] Fix 'dg-warning' in 'c-c++-common/Wfree-nonheap-object-3.c' for C++ [...]/c-c++-common/Wfree-nonheap-object-3.c:57:24: warning: 'malloc (dealloc_float)' attribute ignored with deallocation functions declared 'inline' [-Wattributes] [...]/c-c++-common/Wfree-nonheap-object-3.c:51:1: note: deallocation function declared here [...]/c-c++-common/Wfree-nonheap-object-3.c: In function 'void test_nowarn_int(int)': [...]/c-c++-common/Wfree-nonheap-object-3.c:25:20: warning: 'void __builtin_free(void*)' called on pointer 'p' with nonzero offset 4 [-Wfree-nonheap-object] [...]/c-c++-common/Wfree-nonheap-object-3.c:24:24: note: returned from 'int* alloc_int(int)' [...]/c-c++-common/Wfree-nonheap-object-3.c: In function 'void test_nowarn_long(int)': [...]/c-c++-common/Wfree-nonheap-object-3.c:45:18: warning: 'void dealloc_long(long int*)' called on pointer '<unknown>' with nonzero offset 8 [-Wfree-nonheap-object] [...]/c-c++-common/Wfree-nonheap-object-3.c:44:26: note: returned from 'long int* alloc_long(int)' In function 'void dealloc_float(float*)', inlined from 'void test_nowarn_float(int)' at [...]/c-c++-common/Wfree-nonheap-object-3.c:68:19: [...]/c-c++-common/Wfree-nonheap-object-3.c:53:18: warning: 'void __builtin_free(void*)' called on pointer '<unknown>' with nonzero offset 8 [-Wfree-nonheap-object] [...]/c-c++-common/Wfree-nonheap-object-3.c: In function 'void test_nowarn_float(int)': [...]/c-c++-common/Wfree-nonheap-object-3.c:67:28: note: returned from 'float* alloc_float(int)' PASS: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++98 (test for warnings, line 25) FAIL: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++98 (test for warnings, line 45) PASS: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++98 (test for warnings, line 51) PASS: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++98 (test for warnings, line 53) PASS: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++98 (test for warnings, line 57) FAIL: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++98 (test for excess errors) Excess errors: [...]/c-c++-common/Wfree-nonheap-object-3.c:45:18: warning: 'void dealloc_long(long int*)' called on pointer '<unknown>' with nonzero offset 8 [-Wfree-nonheap-object] ..., that is: decorated 'void dealloc_long(long int*)' instead of plain 'dealloc_long' -- similar to how all the other 'dg-warning's allow for the decorated function signature in addition to the plain one. This issue was latent since the test case was added in commit fe7f75cf16783589eedbab597e6d0b8d35d7e470 "Correct/improve maybe_emit_free_warning (PR middle-end/98166, PR c++/57111, PR middle-end/98160)", and was finally exposed by my recent commit 9c03391ba447ff86038d6a34c90ae737c3915b5f "Tighten 'dg-warning' alternatives in 'c-c++-common/Wfree-nonheap-object{,-2,-3}.c'". gcc/testsuite/ * c-c++-common/Wfree-nonheap-object-3.c: Fix 'dg-warning' for C++. --- gcc/testsuite/c-c++-common/Wfree-nonheap-object-3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/c-c++-common/Wfree-nonheap-object-3.c b/gcc/testsuite/c-c++-common/Wfree-nonheap-object-3.c index 8f20de8455fa..23d89a31454e 100644 --- a/gcc/testsuite/c-c++-common/Wfree-nonheap-object-3.c +++ b/gcc/testsuite/c-c++-common/Wfree-nonheap-object-3.c @@ -42,7 +42,7 @@ void test_nowarn_long (int n) { long *p = alloc_long (n); - dealloc_long (p + 1); // { dg-warning "'dealloc_long' called on pointer '(p|<unknown>)' with nonzero offset" } + dealloc_long (p + 1); // { dg-warning "'(dealloc_long|void dealloc_long\\(long int\\*\\))' called on pointer '(p|<unknown>)' with nonzero offset" } } } -- 2.39.2