From: Bernd Edlinger <bernd.edlinger@hotmail.de>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [committed] libstdc++: Fix std::jthread assertion and re-enable skipped test
Date: Thu, 27 May 2021 14:10:14 +0200 [thread overview]
Message-ID: <AM8PR10MB470865C3C56B9B566FBFB86CE4239@AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AM8PR10MB4708FF89AF35792634A856CEE42B9@AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM>
On 5/19/21 3:37 PM, Bernd Edlinger wrote:
> On 5/19/21 3:27 PM, Jonathan Wakely wrote:
>> On 18/05/21 13:58 +0200, Bernd Edlinger wrote:
>>> On 5/18/21 1:55 PM, Bernd Edlinger wrote:
>>>> On 5/17/21 7:13 PM, Jonathan Wakely via Gcc-patches wrote:
>>>>> libstdc++-v3/ChangeLog:
>>>>>
>>>>> * include/std/thread (jthread::_S_create): Fix static assert
>>>>> message.
>>>>> * testsuite/30_threads/jthread/95989.cc: Re-enable test.
>>>>> * testsuite/30_threads/jthread/jthread.cc: Do not require
>>>>> pthread effective target.
>>>>> * testsuite/30_threads/jthread/2.cc: Moved to...
>>>>> * testsuite/30_threads/jthread/version.cc: ...here.
>>>>>
>>>>> Tested powerpc64le-linux. Committed to trunk.
>>>>>
>>>>> Let's see if this test is actually fixed, or if it still causes
>>>>> failures on some targets.
>>>>>
>>>>>
>>>>
>>>> Yes, indeed it is failing on x86_64-pc-linux-gnu.
>>>>
>>>
>>> that means only this one:
>>>
>>> FAIL: 30_threads/jthread/95989.cc execution test
>>
>> What's your glibc version?
>>
>>
>
> that is ubuntu 20.04 with latest patches:
>
> $ ldd --version
> ldd (Ubuntu GLIBC 2.31-0ubuntu9.3) 2.31
> Copyright (C) 2020 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> Written by Roland McGrath and Ulrich Drepper.
>
The glibc version is probably not the reason,
I've got the same effect with Ubuntu EGLIBC 2.19-0ubuntu6.15 as well.
But I use binutils-2.36.1.
I think the problem is here:
libstdc++-v3/src/c++11/thread.cc: __e = __gthread_join(_M_id._M_thread, 0);
which calls
libgcc/gthr-posix.h: return __gthrw_(pthread_join) (__threadid, __value_ptr);
but this is only a weak reference to pthread_join:
669 return __gthrw_(pthread_join) (__threadid, __value_ptr);
(gdb) disass
Dump of assembler code for function std::thread::join():
0x0000000000405e20 <+0>: endbr64
0x0000000000405e24 <+4>: push %rbx
0x0000000000405e25 <+5>: mov %rdi,%rbx
0x0000000000405e28 <+8>: mov (%rdi),%rdi
0x0000000000405e2b <+11>: test %rdi,%rdi
0x0000000000405e2e <+14>: je 0x405e44 <std::thread::join()+36>
=> 0x0000000000405e30 <+16>: xor %esi,%esi
0x0000000000405e32 <+18>: callq 0x0
0x0000000000405e37 <+23>: test %eax,%eax
0x0000000000405e39 <+25>: jne 0x405e49 <std::thread::join()+41>
0x0000000000405e3b <+27>: movq $0x0,(%rbx)
0x0000000000405e42 <+34>: pop %rbx
0x0000000000405e43 <+35>: retq
0x0000000000405e44 <+36>: mov $0x16,%eax
0x0000000000405e49 <+41>: mov %eax,%edi
0x0000000000405e4b <+43>: callq 0x4012a9 <std::__throw_system_error(int)>
End of assembler dump.
but the pthread_join symbol is not checked for potentially being null.
The test case passes if I change this:
diff --git a/libstdc++-v3/testsuite/30_threads/jthread/95989.cc b/libstdc++-v3/testsuite/30_threads/jthread/95989.cc
index fb3f43bc722..61a3ff76aa1 100644
--- a/libstdc++-v3/testsuite/30_threads/jthread/95989.cc
+++ b/libstdc++-v3/testsuite/30_threads/jthread/95989.cc
@@ -52,4 +52,5 @@ main()
test01();
test02();
test03();
+ pthread_join(NULL, NULL);
}
Thanks
Bernd.
prev parent reply other threads:[~2021-05-27 12:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-17 17:13 Jonathan Wakely
2021-05-18 11:55 ` Bernd Edlinger
2021-05-18 11:58 ` Bernd Edlinger
2021-05-19 13:27 ` Jonathan Wakely
2021-05-19 13:37 ` Bernd Edlinger
2021-05-27 12:10 ` Bernd Edlinger [this message]
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=AM8PR10MB470865C3C56B9B566FBFB86CE4239@AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM \
--to=bernd.edlinger@hotmail.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=jwakely@redhat.com \
--cc=libstdc++@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).