https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96194
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2020-07-14 --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Reduced testcase: typedef decltype (sizeof 0) size_t; void *operator new (size_t, void *b) { return b; } struct A { ~A (); }; struct B : A { float e[64]; }; void * foo (void *x, bool y) { void *p = y ? x : nullptr; return new (p) B (); } (the nullptr is from: static inline void * os_malloc_aligned(size_t size, size_t alignment) { void *ptr; alignment = (alignment + sizeof(void*) - 1) & ~(sizeof(void*) - 1); if(posix_memalign(&ptr, alignment, size) != 0) return NULL; return ptr; } ) and jump threading makes return new (nullptr) B (); out of this. typedef decltype (sizeof 0) size_t; void *operator new (size_t, void *b) { return b; } struct A { ~A (); }; struct B : A { float e[64]; }; void * foo () { return new (nullptr) B (); } ICEs too.