From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-oln040092075088.outbound.protection.outlook.com [40.92.75.88]) by sourceware.org (Postfix) with ESMTPS id A7EB03858025; Thu, 27 May 2021 12:10:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A7EB03858025 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=hotmail.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bernd.edlinger@hotmail.de ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MVXJQi9KKYr8E9cX5OfiqpDCIR9b5V+O8Ql7iJ/rKWZ0yOhPkXPD1pVjcQx2i9/vBLj0oqAqzJqyYWA/NaxDUgtBS2qAsOdy1HDaV5wejm2MmEKu64DN/diIO2Ss+yL0G+gyeoCy4kAm+LwPZtXOQha4OpiPglOSxLqJXdgO6xpFLtv8scRXpeExXqF4VV/Flh1aC2sLXHlieV2+oLjo6Qg58eOg77bVNEt3TRprVPdDPFM+/iTbPlqUlNtNqMoqjgXE8vao1vvA7tXB7Ur2XQmmkg49mhJqZ/IJoHTRYl8tgaJIz5aX3fNhzY9tcuAnsxXnpQRL1VZKdCt/7za/kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y9Cvjp6/VBV4hpWvOw9r+te5a51raaI5j+pxHQJo5jY=; b=dWc0X4K4gfdMICi3iKGlKRSRavKkuPxqmkx50rXgaZovQVRgh7dBPH3Kd7/41Hky/ovYGw2/CpDannNJbRj05NXpqXRNZ/WYROlJisPvauBIK7G5RZtEWegVSZ0MIUu93mcUXTPKK61YGRSf4iyqXT5eazuvw4zBceW9N6sAGGXVsRPu7YtGLD4yhTT8//NqgCKFIPAPMDGMMtfw+RkjrsMoF0JL0k+leVctLPsZ1w9sKLChId6hTEGJDzs8cU72NR4iGWzYg/dV4g+Zzk+R6nJhlY+qfwHmthdQiVJYzEY+GBp8c++QJ0O91gvNyHfnSzjRIJNAY9/FB54GmbjdLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from HE1EUR04FT063.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::52) by HE1EUR04HT200.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::398) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.28; Thu, 27 May 2021 12:10:16 +0000 Received: from AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM (2a01:111:e400:7e0d::41) by HE1EUR04FT063.mail.protection.outlook.com (2a01:111:e400:7e0d::308) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.28 via Frontend Transport; Thu, 27 May 2021 12:10:16 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:EDE1090280930B48F429DEF7B7A1285511A0B75D19458BBA6501DB10CCE63C7F; UpperCasedChecksum:A82A9DF61E842F9682582C6777C04C6BCC62F9E778E5BE189FEF73BAF43F1D8E; SizeAsReceived:8170; Count:48 Received: from AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM ([fe80::ad12:6a2c:b949:f65d]) by AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM ([fe80::ad12:6a2c:b949:f65d%5]) with mapi id 15.20.4173.020; Thu, 27 May 2021 12:10:16 +0000 Subject: Re: [committed] libstdc++: Fix std::jthread assertion and re-enable skipped test From: Bernd Edlinger To: Jonathan Wakely Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org References: Message-ID: Date: Thu, 27 May 2021 14:10:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 8bit X-TMN: [YUJE7TXJaf7KAF8jwTZXqJxsQcG23px5] X-ClientProxiedBy: FR3P281CA0021.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::11) To AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:364::23) X-Microsoft-Original-Message-ID: <8816a1e7-6aa0-526c-a823-5e22ccd54d4f@hotmail.de> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.1.101] (84.57.61.94) by FR3P281CA0021.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.9 via Frontend Transport; Thu, 27 May 2021 12:10:15 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: a8f9f5fa-6229-4b1b-9113-08d921086358 X-MS-TrafficTypeDiagnostic: HE1EUR04HT200: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: USyqQxrYmbVbZK2UqvRbJ6ETv2g5DmWknP6fFy0I+l2/neZDgF1fe+UEDt8IkYxUWREEgc59txRSgHxKwvR/cdDk8oxC2bfMTtHXaGBX2hy38zOhWtVqpGm230BpNKqlOnETE9tC8kMMcaA/dLw5jikJHcj33gpRnOsNcWQ0eyx4TK1FDxV1l65REke+8YuQIr4cixdmEThSmd414bq6fJXMK4BjQ4LM+YDjmA4rFTIuDy8hHYsFeDMKKe+/Z3kmRRX7PAP1M15J3CfRIjAncWAWnVa5I7Dn0naN9LY4AjPx+ebNgPzovgZ2DnmlD15JzZxO6cQPiJKR+TIOH0i5tdlW5v2MaYTKgjAx/F+ax/A2yetUke0V/CQ1IpC9QTPq X-MS-Exchange-AntiSpam-MessageData: 8+yMyeaIkHn4oxEHOLYTe1xzTlnW7H8g+rVkEtm5/SAnQTACb58LLYI8EsAfH2ZvyStAu51pEbboUwZToJq3RgnngTARK8ame0hwpAfblHJy6KpqLREaiinkhmWeG1QQ6D0j0WPk572g6IJu3eYFXA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8f9f5fa-6229-4b1b-9113-08d921086358 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 May 2021 12:10:16.7874 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: HE1EUR04FT063.eop-eur04.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR04HT200 X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, FORGED_MUA_MOZILLA, FREEMAIL_FROM, GIT_PATCH_0, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 May 2021 12:10:21 -0000 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 => 0x0000000000405e30 <+16>: xor %esi,%esi 0x0000000000405e32 <+18>: callq 0x0 0x0000000000405e37 <+23>: test %eax,%eax 0x0000000000405e39 <+25>: jne 0x405e49 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 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.