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)