From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 65F453858C00; Wed, 2 Nov 2022 11:41:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 65F453858C00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667389316; bh=puR85wUQvbqF7z2Ao2KIsSrAfV0rb5bkfRlTBrHuXZU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aevvMd9G9dwmIsL8vIJ9DrnLhwNTBtDAIzB1qeRr2y1HnIehJw7B+9ES0XS2W5Ma3 hY4liEVer6zt7DZ4o3TxpTO9+OOsTuvjoSn1b0p4rgCMK56xxaMxvi542SaWPZ1KZ8 Wuep67k8Qfmot54RqQS7Kpx08OS6utuW76hEJEIY= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/102217] co_awaiting a temporary produced by ternary operator crashes (double-free) Date: Wed, 02 Nov 2022 11:41:53 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: ice-on-valid-code, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords cf_reconfirmed_on bug_status everconfirmed Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102217 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ice-on-valid-code Last reconfirmed| |2022-11-02 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #4 from Jonathan Wakely --- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D624580=3D=3DERROR: AddressSanitizer: heap-use-after-free on address 0x606000000028 at pc 0x0000004042b1 bp 0x7ffe18357490 sp 0x7ffe18357488 READ of size 8 at 0x606000000028 thread T0 #0 0x4042b0 in std::__n4861::coroutine_handle > >::destroy() const /home/jwakely/gcc/12.1.0/include/c++/12.1.0/coroutine:246 #1 0x403cb7 in Co::UniqueHandle > >::~UniqueHandle() /tmp/cocrash.cxx:37 #2 0x403767 in Co::Task::~Task() /tmp/cocrash.cxx:135 #3 0x402a47 in FooC /tmp/cocrash.cxx:171 #4 0x4018c2 in FooA /tmp/cocrash.cxx:160 #5 0x402c11 in FooC /tmp/cocrash.cxx:168 #6 0x403501 in std::__n4861::coroutine_handle::resume() const /home/jwakely/gcc/12.1.0/include/c++/12.1.0/coroutine:135 #7 0x402f84 in main /tmp/cocrash.cxx:177 #8 0x7f66323e750f in __libc_start_call_main (/lib64/libc.so.6+0x2950f) #9 0x7f66323e75c8 in __libc_start_main_impl (/lib64/libc.so.6+0x295c8) #10 0x4011b4 in _start (/tmp/a.out+0x4011b4) 0x606000000028 is located 8 bytes inside of 56-byte region [0x606000000020,0x606000000058) freed by thread T0 here: #0 0x7f66329bcbb8 in operator delete(void*) ../../../../gcc-12.1.0/libsanitizer/asan/asan_new_delete.cpp:152 #1 0x401981 in FooA /tmp/cocrash.cxx:162 #2 0x401a38 in FooA /tmp/cocrash.cxx:160 #3 0x4042b9 in std::__n4861::coroutine_handle > >::destroy() const /home/jwakely/gcc/12.1.0/include/c++/12.1.0/coroutine:246 #4 0x403cb7 in Co::UniqueHandle > >::~UniqueHandle() /tmp/cocrash.cxx:37 #5 0x403767 in Co::Task::~Task() /tmp/cocrash.cxx:135 #6 0x4029ff in FooC /tmp/cocrash.cxx:171 #7 0x4018c2 in FooA /tmp/cocrash.cxx:160 #8 0x402c11 in FooC /tmp/cocrash.cxx:168 #9 0x403501 in std::__n4861::coroutine_handle::resume() const /home/jwakely/gcc/12.1.0/include/c++/12.1.0/coroutine:135 #10 0x402f84 in main /tmp/cocrash.cxx:177 #11 0x7f66323e750f in __libc_start_call_main (/lib64/libc.so.6+0x2950f) previously allocated by thread T0 here: #0 0x7f66329bc178 in operator new(unsigned long) ../../../../gcc-12.1.0/libsanitizer/asan/asan_new_delete.cpp:95 #1 0x40129f in FooA() /tmp/cocrash.cxx:162 #2 0x4027c2 in FooC /tmp/cocrash.cxx:171 #3 0x403501 in std::__n4861::coroutine_handle::resume() const /home/jwakely/gcc/12.1.0/include/c++/12.1.0/coroutine:135 #4 0x402f84 in main /tmp/cocrash.cxx:177 #5 0x7f66323e750f in __libc_start_call_main (/lib64/libc.so.6+0x2950f) SUMMARY: AddressSanitizer: heap-use-after-free /home/jwakely/gcc/12.1.0/include/c++/12.1.0/coroutine:246 in std::__n4861::coroutine_handle > >::destroy() const Shadow bytes around the buggy address: 0x0c0c7fff7fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c0c7fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c0c7fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c0c7fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c0c7fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =3D>0x0c0c7fff8000: fa fa fa fa fd[fd]fd fd fd fd fd fa fa fa fa fa 0x0c0c7fff8010: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa 0x0c0c7fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c0c7fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c0c7fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c0c7fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07=20 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb =3D=3D624580=3D=3DABORTING=