https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111773
--- Comment #6 from Vlad Yaglamunov <vlad at solidsands dot nl> --- I agree with Richard's explanation. Seems like my first example is an undefined behavior. In section [basic.stc.dynamic.allocation] par 2, in C++17, was added the following: "Furthermore, for the library allocation functions in [new.delete.single] and [new.delete.array], p0 shall represent the address of a block of storage disjoint from the storage for any other object accessible to the caller."