Fix overeager signed comparison optimization in gcc-4.4
authorPeter D. Barnes, Jr. <barnes26@llnl.gov>
Thu, 30 Jan 2014 12:18:29 -0800
changeset 10599 f80b2ef21ac5
parent 10598 cc512d2de0f4
child 10600 48c3c6b355a1
Fix overeager signed comparison optimization in gcc-4.4
src/core/test/int64x64-test-suite.cc
--- a/src/core/test/int64x64-test-suite.cc	Thu Jan 30 18:23:54 2014 +0100
+++ b/src/core/test/int64x64-test-suite.cc	Thu Jan 30 12:18:29 2014 -0800
@@ -577,6 +577,14 @@
 public:
   Int64x64CompareTestCase ();
   virtual void DoRun (void);
+
+#if defined (__GNUC__)
+#if (__GNUC__ == 4 && __GNUC_MINOR__ == 4)
+  // gcc-4.4 is overeager to optimize away signed comparisons
+  // which makes it hard to test comparison operators
+  __attribute__ ((optimize ("no-strict-overflow")))
+#endif
+#endif
   void Check (const bool result, const bool expected,
 	      const std::string & msg);
 };