| diff -ur ./include/tr1/shared_ptr.h ../../gcc-4.9.3.patched/libstdc++-v3/include/tr1/shared_ptr.h |
| --- ./include/tr1/shared_ptr.h 2014-01-02 14:30:10.000000000 -0800 |
| +++ ../../gcc-4.9.3.patched/libstdc++-v3/include/tr1/shared_ptr.h 2016-02-01 22:45:11.808475373 -0800 |
| @@ -188,7 +188,7 @@ |
| { |
| // No memory barrier is used here so there is no synchronization |
| // with other threads. |
| - return const_cast<const volatile _Atomic_word&>(_M_use_count); |
| + return __atomic_load_n(&_M_use_count, __ATOMIC_RELAXED); |
| } |
| |
| private: |
| @@ -230,7 +230,7 @@ |
| _M_add_ref_lock() |
| { |
| // Perform lock-free add-if-not-zero operation. |
| - _Atomic_word __count = _M_use_count; |
| + _Atomic_word __count = _M_get_use_count(); |
| do |
| { |
| if (__count == 0) |