From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 1F5CD385841C for ; Mon, 30 Aug 2021 15:45:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1F5CD385841C Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 17UFjlB4028129 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 Aug 2021 11:45:52 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 17UFjlB4028129 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 77BA11E813; Mon, 30 Aug 2021 11:45:47 -0400 (EDT) Subject: Re: [PATCH] Add some parallel_for_each tests To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20210828191838.1552741-1-tom@tromey.com> <874kb7llf2.fsf@tromey.com> <90242728-b05c-81b8-c69f-f9ec60c0d77c@polymtl.ca> <87v93njbd3.fsf@tromey.com> From: Simon Marchi Message-ID: Date: Mon, 30 Aug 2021 11:45:46 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <87v93njbd3.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 30 Aug 2021 15:45:47 +0000 X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2021 15:46:03 -0000 On 2021-08-30 9:44 a.m., Tom Tromey wrote: > Simon> I think you could mention in the commit message that the bug in question > Simon> happened when n_threads == 0, and what is was (a crash, hang, bad > Simon> result, etc). > > Ok, I did that. I'm going to check it in. On Ubuntu 20.04, when compiled with g++-9 or g++-10 (from the g++-9 and g++-10 repo packages): CXX unittests/parallel-for-selftests.o /home/smarchi/src/binutils-gdb/gdb/unittests/parallel-for-selftests.c: In function ‘void selftests::parallel_for::test(int)’: /home/smarchi/src/binutils-gdb/gdb/unittests/parallel-for-selftests.c:53:30: error: use of deleted function ‘std::atomic::atomic(const std::atomic&)’ 53 | std::atomic counter = 0; | ^ In file included from /usr/include/c++/9/future:42, from /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/thread-pool.h:29, from /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/parallel-for.h:26, from /home/smarchi/src/binutils-gdb/gdb/unittests/parallel-for-selftests.c:22: /usr/include/c++/9/atomic:755:7: note: declared here 755 | atomic(const atomic&) = delete; | ^~~~~~ /usr/include/c++/9/atomic:759:17: note: after user-defined conversion: ‘constexpr std::atomic::atomic(std::atomic::__integral_type)’ 759 | constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } | ^~~~~~ I didn't dig to understand the why, but this works: std::atomic counter { 0 }; Simon