From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9AD233858422; Mon, 29 May 2023 01:34:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9AD233858422 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685324059; bh=6n37l+abpLhSbh9CiGGrO0XwXgddhvtuYmUswvZ7X3g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XRxM5evfePeNya1kwDfWXrliSC4q7NpqrUbupAQhdQFhNnjfkObMscmEus3uigamk qq+4TnrQVGNKXKsKYdTI5SU0HNrYVsSL9Y1nYY5THe+xLhBawv2270HChiF7O0pthO +2X1bK+t6JBzvw8Iw54NwqybuKvSTHCV4F6U4jIs= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/110016] Possible miscodegen when inlining std::condition_variable::wait predicate causes deadlock Date: Mon, 29 May 2023 01:34:19 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: 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=3D110016 --- Comment #8 from Andrew Pinski --- Here is the backtrace in that case: (gdb) bt #0 0x0000fffff6acd22c in futex_wait_cancelable (private=3D, expected=3D0, futex_word=3D0xfffff3103c64) at ../sysdeps/unix/sysv/linux/futex-internal.h:88 #1 __pthread_cond_wait_common (abstime=3D0x0, mutex=3D0xfffff3103c08, cond=3D0xfffff3103c38) at pthread_cond_wait.c:502 #2 __pthread_cond_wait (cond=3D0xfffff3103c38, mutex=3D0xfffff3103c08) at pthread_cond_wait.c:655 #3 0x0000fffff6efc2e4 in __tsan::call_pthread_cancel_with_cleanup (fn=3Dfn@entry=3D0xfffff6eafd00 <_FUN(void*)>, cleanup=3Dcleanup@entry=3D0x= fffff6eb5364 <_FUN(void*)>, arg=3Darg@entry=3D0xffffe5f3dff0) at /home/ubuntu/src/upstream-gcc-aarch64/gcc/libsanitizer/tsan/tsan_platform_l= inux.cpp:493 #4 0x0000fffff6ed4194 in cond_wait<__interceptor_pthread_cond_wait(void*, void*):: > (m=3D0xfffff3103c08, c=3D0xfffff3103c38, fn=3D..., si=3D0xffffe5f3dfd0, pc=3D281474824487080, thr=3D) at /home/ubuntu/src/upstream-gcc-aarch64/gcc/libsanitizer/tsan/tsan_intercepto= rs_posix.cpp:1259 #5 __interceptor_pthread_cond_wait (c=3D, m=3D0xfffff3103c0= 8) at /home/ubuntu/src/upstream-gcc-aarch64/gcc/libsanitizer/tsan/tsan_intercepto= rs_posix.cpp:1270 #6 0x00000000004045f4 in std::condition_variable::wait::waitWork()::{lambda()#1}>(std::unique_lock&, substrate::threadPool_t::waitWork()::{lambda()#1}) (this=3Dthis@entry=3D0xfffff3103c38, __lock=3D..., __p=3D__p@entry=3D...) at /home/ubuntu/upstream-gcc/include/c++/14.0.0/condition_variable:102 #7 0x00000000004064e0 in substrate::threadPool_t::waitWork() (this=3Dthis@entry=3D0xfffff3103c00) at t.cc:282 #8 0x00000000004081e4 in substrate::threadPool_t::workerThread(unsigned long) (this=3Dthis@entry=3D0xfffff3103c00, processor=3D) at t.cc:310 #9 0x0000000000408234 in substrate::threadPool_t::threadPool_t(bo= ol (*)())::{lambda(unsigned long)#1}::operator()(unsigned long) const (currentProcessor=3D, __closure=3D) at t.cc:337 #10 0x0000000000408294 in std::__invoke_impl::threadPool_t(bool (*)())::{lambda(unsigned long)#1}, unsigned long>(std::__invoke_other, substrate::threadPool_t::threadPool_t(b= ool (*)())::{lambda(unsigned long)#1}&&, unsigned long&&) (__f=3D...) at /home/ubuntu/upstream-gcc/include/c++/14.0.0/bits/invoke.h:60 #11 0x00000000004082e0 in std::__invoke::threadPool_t(bool (*)())::{lambda(unsigned long)#1}, unsigned long>(std::__invoke_result&&, (substrate::threadPool_t::threadPool_t(bool (*)())::{lambda(unsigned long)#1}&&)...) (__fn=3D...) at /home/ubuntu/upstream-gcc/include/c++/14.0.0/bits/invoke.h:90 #12 0x00000000004084d4 in std::thread::_Invoker::threadPool_t(bool (*)())::{lambda(unsigned long)#1}, unsigned long> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) (this=3Dthis@entry=3D0xfffff56004a8) at /home/ubuntu/upstream-gcc/include/c++/14.0.0/bits/std_thread.h:291 #13 0x0000000000408504 in std::thread::_Invoker::threadPool_t(bool (*)())::{lambda(unsigned long)#1}, unsigned long> >::operator()() (this=3Dthis@entry=3D0xfffff56004a8) at /home/ubuntu/upstream-gcc/include/c++/14.0.0/bits/std_thread.h:295 #14 0x0000000000408534 in std::thread::_State_impl::threadPool_t(bool (*)())::{lambda(unsigned long)#1}, unsigned long> > >::_M_run() (this=3D0xfffff56004a0) at /home/ubuntu/upstream-gcc/include/c++/14.0.0/bits/std_thread.h:244 #15 0x0000fffff6ced74c in std::execute_native_thread_routine (__p=3D0xfffff56004a0) at /home/ubuntu/src/upstream-gcc-aarch64/gcc/libstdc++-v3/src/c++11/thread.cc:= 104 #16 0x0000fffff6eaf63c in __tsan_thread_start_func (arg=3D0xfffffffff6f0) at /home/ubuntu/src/upstream-gcc-aarch64/gcc/libsanitizer/tsan/tsan_intercepto= rs_posix.cpp:1038 #17 0x0000fffff6ac7088 in start_thread (arg=3D0xfffffffff62f) at pthread_create.c:463 #18 0x0000fffff6a304ec in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:78=