From b1085b7384d91fb81e4e66e3bcd57f5900d83984 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 31 Jul 2015 10:22:15 -0400 Subject: Changed Cygwin to use -O2 instead of -O3 with GCC 4.9 due to crash --- smartptr.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'smartptr.h') diff --git a/smartptr.h b/smartptr.h index 82937333..057f5213 100644 --- a/smartptr.h +++ b/smartptr.h @@ -79,6 +79,12 @@ public: T *old_p = m_p; m_p = 0; return old_p; + +#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 } void reset(T *p = 0); -- cgit v1.2.1