]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/60272 (atomic<>::compare_exchange_weak has spurious store and can cause...
authorRichard Henderson <rth@redhat.com>
Fri, 21 Feb 2014 00:11:43 +0000 (16:11 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Fri, 21 Feb 2014 00:11:43 +0000 (16:11 -0800)
PR c++/60272

        * builtins.c (expand_builtin_atomic_compare_exchange): Always make
        a new pseudo for OLDVAL.

From-SVN: r207972

gcc/ChangeLog
gcc/builtins.c

index cbdecf83d202a01c7cc6d0fc7f6ff1aba5e66721..c51d139850e15dd5b641c276eeee5f673a56033f 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-20  Richard Henderson  <rth@redhat.com>
+
+       PR c++/60272
+       * builtins.c (expand_builtin_atomic_compare_exchange): Always make
+       a new pseudo for OLDVAL.
+
 2014-02-20  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/57896
index 09fefe50a8d91d0b444877b511e4b8e990badf43..35969ad41844feee6d44d4f8bfe19a857167998f 100644 (file)
@@ -5332,9 +5332,12 @@ expand_builtin_atomic_compare_exchange (enum machine_mode mode, tree exp,
 
   if (target == const0_rtx)
     target = NULL;
-  oldval = expect;
 
-  if (!expand_atomic_compare_and_swap (&target, &oldval, mem, oldval, desired,
+  /* Lest the rtl backend create a race condition with an imporoper store
+     to memory, always create a new pseudo for OLDVAL.  */
+  oldval = NULL;
+
+  if (!expand_atomic_compare_and_swap (&target, &oldval, mem, expect, desired,
                                       is_weak, success, failure))
     return NULL_RTX;
 
This page took 0.081254 seconds and 5 git commands to generate.