https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57111

--- Comment #19 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Thomas Schwinge <tschwi...@gcc.gnu.org>:

https://gcc.gnu.org/g:df071fbd467f0cb3711119ef41d74792fc5e6c8c

commit r14-1838-gdf071fbd467f0cb3711119ef41d74792fc5e6c8c
Author: Thomas Schwinge <tho...@codesourcery.com>
Date:   Wed Jun 7 17:12:01 2023 +0200

    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++.

Reply via email to