public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Sandra Loosemore <sandra@codesourcery.com>
Cc: Hans-Peter Nilsson <hp@bitrange.com>,
	pinskia@gmail.com,        David Edelsohn <dje.gcc@gmail.com>,
	       Torvald Riegel <triegel@redhat.com>,
	       GCC Patches <gcc-patches@gcc.gnu.org>,
	       "libstdc++@gcc.gnu.org" <libstdc++@gcc.gnu.org>
Subject: Re: Re: [patch libstdc++] Optimize synchronization in std::future if futexes are available.
Date: Sat, 17 Jan 2015 21:13:00 -0000	[thread overview]
Message-ID: <20150117202356.GT3360@redhat.com> (raw)
In-Reply-To: <54BABF38.7080602@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 1654 bytes --]

On 17/01/15 12:59 -0700, Sandra Loosemore wrote:
>Re:
>
>>On 17/01/15 01:45 -0500, Hans-Peter Nilsson wrote:
>>>On Fri, 16 Jan 2015, pinskia@gmail.com wrote:
>>>>> On Jan 16, 2015, at 9:57 PM, David Edelsohn <dje.gcc@gmail.com> wrote:
>>>>>
>>>>> This patch has broken bootstrap on AIX
>>>>>
>>>>> May I mention that this really should have been tested on systems
>>>>> other than x86 Linux.
>>>>
>>>>It also broke all newlib targets too. So you could have tested one listed in the sim-test web page.
>>>
>>>For those interested, PR64638.
>>
>>Should be fixed in trunk now, by this patch.
>
>I'm now getting this error in an arm-none-linux-gnueabi cross build:
>
>
>In file included from /scratch/sandra/arm-fsf2/obj/gcc-mainline-0-arm-none-linux-gnueabi-i686-pc-linux-gnu/arm-none-linux-gnueabi/libstdc++-v3/include/future:44:0,
>                 from /scratch/sandra/arm-fsf2/src/gcc-mainline/libstdc++-v3/src/c++11/functexcept.cc:34:
>/scratch/sandra/arm-fsf2/obj/gcc-mainline-0-arm-none-linux-gnueabi-i686-pc-linux-gnu/arm-none-linux-gnueabi/libstdc++-v3/include/bits/atomic_futex.h:71:3: 
>error: #error We require lock-free atomic operations on int
> # error We require lock-free atomic operations on int
>   ^
>
>It used to work a few days ago....  nothing changed in my build 
>environment except that I did "svn up" in my gcc source directory....

Well that file didn't exist until yesterday :-)

Does the attached patch fix it?

The new __atomic_futex_unsigned type is only used in <future> when
ATOMIC_LOCK_FREE > 1, so there's no point trying to define it and
then failing if int is not lock-free, as the type isn't going to be
used anyway.


[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 1277 bytes --]

diff --git a/libstdc++-v3/include/bits/atomic_futex.h b/libstdc++-v3/include/bits/atomic_futex.h
index 2673604..b4138ba 100644
--- a/libstdc++-v3/include/bits/atomic_futex.h
+++ b/libstdc++-v3/include/bits/atomic_futex.h
@@ -49,7 +49,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
-#if defined(_GLIBCXX_HAVE_LINUX_FUTEX)
+#if defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1
   struct __atomic_futex_unsigned_base
   {
     // Returns false iff a timeout occurred.
@@ -66,10 +66,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   {
     typedef chrono::system_clock __clock_t;
 
-    // XXX We expect this to be lock-free, and having the payload at offset 0.
-#if ATOMIC_INT_LOCK_FREE < 2
-# error We require lock-free atomic operations on int
-#endif
+    // This must be lock-free and at offset 0.
     atomic<unsigned> _M_data;
 
     __atomic_futex_unsigned(unsigned __data) : _M_data(__data)
@@ -281,7 +278,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   };
 
-#endif // _GLIBCXX_HAVE_LINUX_FUTEX
+#endif // _GLIBCXX_HAVE_LINUX_FUTEX && ATOMIC_INT_LOCK_FREE > 1
 #endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
 
 _GLIBCXX_END_NAMESPACE_VERSION

  reply	other threads:[~2015-01-17 20:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-17  6:45 David Edelsohn
2015-01-17  7:24 ` pinskia
2015-01-17  8:06   ` Hans-Peter Nilsson
2015-01-17 11:00     ` Jonathan Wakely
2015-01-17 14:30     ` Jonathan Wakely
2015-01-17 20:55       ` Sandra Loosemore
2015-01-17 21:13         ` Jonathan Wakely [this message]
2015-01-17 22:54           ` Sandra Loosemore
2015-01-17 22:58             ` Jonathan Wakely
2015-01-18  0:08               ` Sandra Loosemore
2015-01-18  0:24                 ` Jonathan Wakely
2015-01-18  8:37                   ` Sandra Loosemore
2015-01-18 15:32                     ` Jonathan Wakely
2015-01-18 15:49                       ` Jonathan Wakely
2015-02-01 15:13                         ` Jonathan Wakely
2015-01-29  3:35                       ` Doug Gilmore

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=20150117202356.GT3360@redhat.com \
    --to=jwakely@redhat.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hp@bitrange.com \
    --cc=libstdc++@gcc.gnu.org \
    --cc=pinskia@gmail.com \
    --cc=sandra@codesourcery.com \
    --cc=triegel@redhat.com \
    /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).