]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libitm/method-ml.cc
* decl.c (cxx_maybe_build_cleanup): When clearing location of cleanup,
[thirdparty/gcc.git] / libitm / method-ml.cc
index fcae334c385a2a03ea501caac6c1dc102737ba4b..24f7ff5fe676ba7275d0b3f19808d7c5ab603ad6 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2017 Free Software Foundation, Inc.
+/* Copyright (C) 2012-2019 Free Software Foundation, Inc.
    Contributed by Torvald Riegel <triegel@redhat.com>.
 
    This file is part of the GNU Transactional Memory Library (libitm).
@@ -138,7 +138,11 @@ struct ml_mg : public method_group
     // This store is only executed while holding the serial lock, so relaxed
     // memory order is sufficient here.  Same holds for the memset.
     time.store(0, memory_order_relaxed);
-    memset(orecs, 0, sizeof(atomic<gtm_word>) * L2O_ORECS);
+    // The memset below isn't strictly kosher because it bypasses
+    // the non-trivial assignment operator defined by std::atomic.  Using
+    // a local void* is enough to prevent GCC from warning for this.
+    void *p = orecs;
+    memset(p, 0, sizeof(atomic<gtm_word>) * L2O_ORECS);
   }
 };