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

--- Comment #10 from Marc Glisse <glisse at gcc dot gnu.org> ---
I am still getting -1 at -O2 for

#include <stdio.h>
#include <new>
int count = 0;
__attribute__((malloc,noinline))
void* operator new[](unsigned long sz){++count;return ::operator new(sz);}
void operator delete[](void* ptr)noexcept{--count;::operator delete(ptr);}
void operator delete[](void* ptr, std::size_t sz)noexcept{--count;::operator
delete(ptr, sz);}
int main(){
  delete[] new int[1];
  printf("%d\n",count); // Should print 0.
}

I am not aware of any code that breaks in practice, but it still looks strange.

Reply via email to