https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96504
--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> --- With glibc 2.31, I got ==2688647== Memcheck, a memory error detector ==2688647== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==2688647== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info ==2688647== Command: ./dynamic ==2688647== ==2688647== Invalid read of size 8 ==2688647== at 0x401405: std::__n4861::coroutine_handle<void>::done() const (coroutine:121) ==2688647== by 0x4013D1: main (pr95519-05-gro.C:53) ==2688647== Address 0x4d7ec80 is 0 bytes inside a block of size 48 free'd ==2688647== at 0x483BEDD: operator delete(void*) (vg_replace_malloc.c:584) ==2688647== by 0x401350: _ZL3fooRNSt7__n486116coroutine_handleIvEE.actor(foo(std::__n4861::coroutine_handle<void>&)::_ZL3fooRNSt7__n486116coroutine_handleIvEE.frame*) (pr95519-05-gro.C:41) ==2688647== by 0x40142A: std::__n4861::coroutine_handle<void>::resume() const (coroutine:126) ==2688647== by 0x4013C5: main (pr95519-05-gro.C:52) ==2688647== Block was alloc'd at ==2688647== at 0x483AE7D: operator new(unsigned long) (vg_replace_malloc.c:342) ==2688647== by 0x40115D: foo(std::__n4861::coroutine_handle<void>&) (pr95519-05-gro.C:41) ==2688647== by 0x4013A4: main (pr95519-05-gro.C:46) ==2688647==