From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2136) id 751D8389042E; Wed, 17 Jun 2020 19:29:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 751D8389042E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592422173; bh=z64wdwDdgluR9cDiOdHs6e1a/f4jsiwYJH/dCDTs0Zw=; h=From:To:Subject:Date:From; b=b1FwqAQ2r2nOSwAQ4/emVKQUChpxg0nHiIzkRTgI4oJKfJ9a/bDMD0VEf2z2+SI13 w0f8V4U4wRUNxQzFI/DTxk90WbeAN6U8f1UacgYxN46yfxltztxP67NzzpAkxu5FCO WAzEj7lAJqg6D7PC6+Q3/X7zX7LBlxpBT5xV8vMc= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Aldy Hernandez To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc/devel/ranger] libstdc++: Fix call to __glibcxx_rwlock_init (PR 93244) X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/devel/ranger X-Git-Oldrev: 068fe0a9e9910ea795229d65b094757633e84524 X-Git-Newrev: b0815713a32c5cc062bd41fa75dac4d4408215fb Message-Id: <20200617192933.751D8389042E@sourceware.org> Date: Wed, 17 Jun 2020 19:29:33 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2020 19:29:33 -0000 https://gcc.gnu.org/g:b0815713a32c5cc062bd41fa75dac4d4408215fb commit b0815713a32c5cc062bd41fa75dac4d4408215fb Author: Jonathan Wakely Date: Fri Mar 6 12:03:17 2020 +0000 libstdc++: Fix call to __glibcxx_rwlock_init (PR 93244) When the target doesn't define PTHREAD_RWLOCK_INITIALIZER we use a wrapper around pthread_wrlock_init, but the wrapper only takes one argument and we try to call it with two. This went unnnoticed on most targets because they do define the PTHREAD_RWLOCK_INITIALIZER macro, but it causes a bootstrap failure on darwin8. PR libstdc++/93244 * include/std/shared_mutex [!PTHREAD_RWLOCK_INITIALIZER] (__shared_mutex_pthread::__shared_mutex_pthread()): Remove incorrect second argument to __glibcxx_rwlock_init. * testsuite/30_threads/shared_timed_mutex/94069.cc: New test. Diff: --- libstdc++-v3/ChangeLog | 6 +++++ libstdc++-v3/include/std/shared_mutex | 2 +- .../30_threads/shared_timed_mutex/94069.cc | 28 ++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index b9ea649eed6..b226bbbffa4 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,11 @@ 2020-03-06 Jonathan Wakely + PR libstdc++/93244 + * include/std/shared_mutex [!PTHREAD_RWLOCK_INITIALIZER] + (__shared_mutex_pthread::__shared_mutex_pthread()): Remove incorrect + second argument to __glibcxx_rwlock_init. + * testsuite/30_threads/shared_timed_mutex/94069.cc: New test. + PR libstdc++/93244 * testsuite/27_io/filesystem/path/generic/generic_string.cc: Adjust test to not fail due to PR 94063. diff --git a/libstdc++-v3/include/std/shared_mutex b/libstdc++-v3/include/std/shared_mutex index 1d0ce673a76..9b597e76299 100644 --- a/libstdc++-v3/include/std/shared_mutex +++ b/libstdc++-v3/include/std/shared_mutex @@ -160,7 +160,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: __shared_mutex_pthread() { - int __ret = __glibcxx_rwlock_init(&_M_rwlock, NULL); + int __ret = __glibcxx_rwlock_init(&_M_rwlock); if (__ret == ENOMEM) __throw_bad_alloc(); else if (__ret == EAGAIN) diff --git a/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/94069.cc b/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/94069.cc new file mode 100644 index 00000000000..6e5cf5f0c6e --- /dev/null +++ b/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/94069.cc @@ -0,0 +1,28 @@ +// Copyright (C) 2020 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-do compile } +// { dg-options "-pthread" } +// { dg-require-effective-target c++14 } +// { dg-require-effective-target pthread } +// { dg-require-gthreads "" } +// +#include +// This is probably undefined, but we do it to simulate a Pthreads target +// that doesn't define the macro: +#undef PTHREAD_RWLOCK_INITIALIZER +#include