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

Serdar Sanli <mserdarsanli at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mserdarsanli at gmail dot com

--- Comment #9 from Serdar Sanli <mserdarsanli at gmail dot com> ---
A simpler example not involving any globals, causing Wfree-nonheap-object
warning since GCC11
https://godbolt.org/z/MYn1zrjE4

===
struct Foo {
    void allocate(int n);
    void deallocate();

    int *_data;
};

void Foo::allocate(int n) {
    _data = new int[n] - 1;
}

void Foo::deallocate() {
    delete[] (_data+1);
}
  • [Bug middle-end/54202] Overeage... mserdarsanli at gmail dot com via Gcc-bugs

Reply via email to