public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-110016-4-AkXwpOMBRw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110016-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is the backtrace in that case:
(gdb) bt
#0  0x0000fffff6acd22c in futex_wait_cancelable (private=<optimized out>,
expected=0, futex_word=0xfffff3103c64) at
../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0xfffff3103c08,
cond=0xfffff3103c38) at pthread_cond_wait.c:502
#2  __pthread_cond_wait (cond=0xfffff3103c38, mutex=0xfffff3103c08) at
pthread_cond_wait.c:655
#3  0x0000fffff6efc2e4 in __tsan::call_pthread_cancel_with_cleanup
(fn=fn@entry=0xfffff6eafd00 <_FUN(void*)>, cleanup=cleanup@entry=0xfffff6eb5364
<_FUN(void*)>, arg=arg@entry=0xffffe5f3dff0) at
/home/ubuntu/src/upstream-gcc-aarch64/gcc/libsanitizer/tsan/tsan_platform_linux.cpp:493
#4  0x0000fffff6ed4194 in cond_wait<__interceptor_pthread_cond_wait(void*,
void*)::<lambda()> > (m=0xfffff3103c08, c=0xfffff3103c38, fn=...,
si=0xffffe5f3dfd0, pc=281474824487080, thr=<optimized out>) at
/home/ubuntu/src/upstream-gcc-aarch64/gcc/libsanitizer/tsan/tsan_interceptors_posix.cpp:1259
#5  __interceptor_pthread_cond_wait (c=<optimized out>, m=0xfffff3103c08) at
/home/ubuntu/src/upstream-gcc-aarch64/gcc/libsanitizer/tsan/tsan_interceptors_posix.cpp:1270
#6  0x00000000004045f4 in
std::condition_variable::wait<substrate::threadPool_t<bool
()>::waitWork()::{lambda()#1}>(std::unique_lock<std::mutex>&,
substrate::threadPool_t<bool ()>::waitWork()::{lambda()#1})
(this=this@entry=0xfffff3103c38, __lock=..., __p=__p@entry=...)
    at /home/ubuntu/upstream-gcc/include/c++/14.0.0/condition_variable:102
#7  0x00000000004064e0 in substrate::threadPool_t<bool ()>::waitWork()
(this=this@entry=0xfffff3103c00) at t.cc:282
#8  0x00000000004081e4 in substrate::threadPool_t<bool
()>::workerThread(unsigned long) (this=this@entry=0xfffff3103c00,
processor=<error reading variable: dwarf2_find_location_expression: Corrupted
DWARF expression.>) at t.cc:310
#9  0x0000000000408234 in substrate::threadPool_t<bool ()>::threadPool_t(bool
(*)())::{lambda(unsigned long)#1}::operator()(unsigned long) const
(currentProcessor=<error reading variable: dwarf2_find_location_expression:
Corrupted DWARF expression.>,
    __closure=<error reading variable: dwarf2_find_location_expression:
Corrupted DWARF expression.>) at t.cc:337
#10 0x0000000000408294 in std::__invoke_impl<void, substrate::threadPool_t<bool
()>::threadPool_t(bool (*)())::{lambda(unsigned long)#1}, unsigned
long>(std::__invoke_other, substrate::threadPool_t<bool ()>::threadPool_t(bool
(*)())::{lambda(unsigned long)#1}&&, unsigned long&&) (__f=...)
    at /home/ubuntu/upstream-gcc/include/c++/14.0.0/bits/invoke.h:60
#11 0x00000000004082e0 in std::__invoke<substrate::threadPool_t<bool
()>::threadPool_t(bool (*)())::{lambda(unsigned long)#1}, unsigned
long>(std::__invoke_result&&, (substrate::threadPool_t<bool
()>::threadPool_t(bool (*)())::{lambda(unsigned long)#1}&&)...) (__fn=...)
    at /home/ubuntu/upstream-gcc/include/c++/14.0.0/bits/invoke.h:90
#12 0x00000000004084d4 in
std::thread::_Invoker<std::tuple<substrate::threadPool_t<bool
()>::threadPool_t(bool (*)())::{lambda(unsigned long)#1}, unsigned long>
>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>)
(this=this@entry=0xfffff56004a8) at
/home/ubuntu/upstream-gcc/include/c++/14.0.0/bits/std_thread.h:291
#13 0x0000000000408504 in
std::thread::_Invoker<std::tuple<substrate::threadPool_t<bool
()>::threadPool_t(bool (*)())::{lambda(unsigned long)#1}, unsigned long>
>::operator()() (this=this@entry=0xfffff56004a8) at
/home/ubuntu/upstream-gcc/include/c++/14.0.0/bits/std_thread.h:295
#14 0x0000000000408534 in
std::thread::_State_impl<std::thread::_Invoker<std::tuple<substrate::threadPool_t<bool
()>::threadPool_t(bool (*)())::{lambda(unsigned long)#1}, unsigned long> >
>::_M_run() (this=0xfffff56004a0) at
/home/ubuntu/upstream-gcc/include/c++/14.0.0/bits/std_thread.h:244
#15 0x0000fffff6ced74c in std::execute_native_thread_routine
(__p=0xfffff56004a0) at
/home/ubuntu/src/upstream-gcc-aarch64/gcc/libstdc++-v3/src/c++11/thread.cc:104
#16 0x0000fffff6eaf63c in __tsan_thread_start_func (arg=0xfffffffff6f0) at
/home/ubuntu/src/upstream-gcc-aarch64/gcc/libsanitizer/tsan/tsan_interceptors_posix.cpp:1038
#17 0x0000fffff6ac7088 in start_thread (arg=0xfffffffff62f) at
pthread_create.c:463
#18 0x0000fffff6a304ec in thread_start () at
../sysdeps/unix/sysv/linux/aarch64/clone.S:78

  parent reply	other threads:[~2023-05-29  1:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-28 21:11 [Bug c++/110016] New: [12/13/14] " amy at amyspark dot me
2023-05-28 21:44 ` [Bug libstdc++/110016] " pinskia at gcc dot gnu.org
2023-05-29  0:47 ` [Bug libstdc++/110016] " amy at amyspark dot me
2023-05-29  1:03 ` pinskia at gcc dot gnu.org
2023-05-29  1:05 ` pinskia at gcc dot gnu.org
2023-05-29  1:05 ` pinskia at gcc dot gnu.org
2023-05-29  1:20 ` pinskia at gcc dot gnu.org
2023-05-29  1:27 ` pinskia at gcc dot gnu.org
2023-05-29  1:34 ` pinskia at gcc dot gnu.org [this message]
2023-05-29  1:47 ` pinskia at gcc dot gnu.org
2023-05-29  6:43 ` pinskia at gcc dot gnu.org
2023-05-29 13:30 ` rachel at rachelmant dot com
2023-05-29 14:28 ` pinskia at gcc dot gnu.org
2023-05-29 15:15 ` pinskia at gcc dot gnu.org
2023-05-29 15:18 ` rachel at rachelmant dot com
2023-05-29 15:37 ` pinskia at gcc dot gnu.org
2023-05-29 20:38 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-110016-4-AkXwpOMBRw@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).