public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115048] New: warning "operator delete called on pointer '<unknown>' with nonzero offset"
@ 2024-05-12  8:29 urisimchoni at gmail dot com
  2024-05-28 20:11 ` [Bug c++/115048] " urisimchoni at gmail dot com
  0 siblings, 1 reply; 2+ messages in thread
From: urisimchoni at gmail dot com @ 2024-05-12  8:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115048
           Summary: warning "operator delete called on pointer '<unknown>'
                    with nonzero offset"
           Product: gcc
           Version: 14.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: urisimchoni at gmail dot com
  Target Milestone: ---

Compiling the following code with gcc 14.1.0 and -O3 yields the warning:

/opt/compiler-explorer/gcc-14.1.0/include/c++/14.1.0/bits/new_allocator.h:172:33:
warning: 'void operator delete(void*, std::size_t)' called on pointer
'<unknown>' with nonzero offset [1, 2147483647] [-Wfree-nonheap-object]

<begin code>
#include <vector>

std::vector<char> get_vec(int extra)
{
        std::vector<char> res;
        res.reserve(extra);
        res.push_back(7);
        return res;
}
<end code>

See also https://godbolt.org/z/rPr7KEhYa

This does not happen with 13.2.0, and does happen with trunk (according to
compiler explorer)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/115048] warning "operator delete called on pointer '<unknown>' with nonzero offset"
  2024-05-12  8:29 [Bug c++/115048] New: warning "operator delete called on pointer '<unknown>' with nonzero offset" urisimchoni at gmail dot com
@ 2024-05-28 20:11 ` urisimchoni at gmail dot com
  0 siblings, 0 replies; 2+ messages in thread
From: urisimchoni at gmail dot com @ 2024-05-28 20:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Uri Simchoni <urisimchoni at gmail dot com> ---
Is this a false-positive of the compiler or an actual issue with libstdc++ or
the compiler compiles it?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-28 20:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-12  8:29 [Bug c++/115048] New: warning "operator delete called on pointer '<unknown>' with nonzero offset" urisimchoni at gmail dot com
2024-05-28 20:11 ` [Bug c++/115048] " urisimchoni at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).