diff options
Diffstat (limited to 'smartptr.h')
-rw-r--r-- | smartptr.h | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -3,7 +3,6 @@ #include "config.h" #include "stdcpp.h" -#include "misc.h" #include "trap.h" NAMESPACE_BEGIN(CryptoPP) @@ -52,8 +51,11 @@ template <class T> simple_ptr<T>::~simple_ptr() delete m_p; m_p = NULL; - // https://github.com/weidai11/cryptopp/issues/6 - MEMORY_BARRIER(); +#ifdef __GNUC__ + // From Andrew Haley (GCC Dev), to tame the optimizer so the assignment is always performed. + // See "Disable optimizations in one function" on the GCC mailing list. + asm volatile ("" : : : "memory"); +#endif } template <class T> class member_ptr |