Workaround for a gcc crash
authorJun Qu <jun@fb.com>
Fri, 6 Oct 2017 16:54:59 +0000 (09:54 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 6 Oct 2017 17:06:15 +0000 (10:06 -0700)
Summary: I recently got a gcc crash when using `ConcurrentHashMap`

Reviewed By: djwatson

Differential Revision: D5994587

fbshipit-source-id: 412d48aa6da12c428bb9ab5ed7a317d89c9580b9

folly/concurrency/ConcurrentHashMap.h

index f261ac98f4039e755dbb93fdce461460ca30975e..65816b6d3fd6080f5daa96c9856781eb0cbd0bc7 100644 (file)
@@ -464,9 +464,9 @@ class ConcurrentHashMap {
   }
 
   SegmentT* ensureSegment(uint64_t i) const {
-    auto seg = segments_[i].load(std::memory_order_acquire);
+    SegmentT* seg = segments_[i].load(std::memory_order_acquire);
     if (!seg) {
-      auto newseg = (SegmentT*)Allocator().allocate(sizeof(SegmentT));
+      SegmentT* newseg = (SegmentT*)Allocator().allocate(sizeof(SegmentT));
       newseg = new (newseg)
           SegmentT(size_ >> ShardBits, load_factor_, max_size_ >> ShardBits);
       if (!segments_[i].compare_exchange_strong(seg, newseg)) {