]> OCCT Git - occt-copy.git/commitdiff
On Apple with XCode 9.4.1 and onwards, the compiler optimization is disabled for... CR0_CADViewer2
authorabv <abv@opencascade.com>
Thu, 26 Jul 2018 17:41:00 +0000 (20:41 +0300)
committeribs <ibs@opencascade.com>
Fri, 27 Jul 2018 11:22:00 +0000 (14:22 +0300)
src/gp/gp_Mat.lxx
src/gp/gp_Trsf.cxx

index 1a604e03fdf2d595dce7d38ec3f1abb42993fffe..f2bb985545d49593d9ef8ff138d0529724af623e 100644 (file)
@@ -321,6 +321,14 @@ inline gp_Mat gp_Mat::Subtracted (const gp_Mat& Other) const
   return NewMat;
 }
 
+// On macOS 10.13.6 with XCode 9.4.1 the compiler has a bug leading to 
+// generation of invalid code when method gp_Mat::Transpose() is called 
+// for a matrix which is when applied to vector; it looks like vector
+// is transformed before the matrix is actually transposed; see #29978.
+// To avoid this, we disable compiler optimization here.
+#if defined(__APPLE__) && (__apple_build_version__ > 9020000)
+__attribute__((optnone))
+#endif
 inline void gp_Mat::Transpose ()
 {
   Standard_Real Temp;
index 5e5980e20b5e4686e2bd752b3b8fca98d48a072e..64014935752759b02cb8081418da2f72b7f7eec5 100644 (file)
@@ -401,16 +401,12 @@ void gp_Trsf::Invert()
   if (shape == gp_Identity) { }
   else if (shape == gp_Translation || shape == gp_PntMirror) loc.Reverse();
   else if (shape == gp_Scale) {
-    Standard_Real As = scale;
-    if (As < 0) As = - As;
-    Standard_ConstructionError_Raise_if (As <= gp::Resolution(), "gp_Trsf::Invert() - transformation has zero scale");
+    Standard_ConstructionError_Raise_if (Abs(scale) <= gp::Resolution(), "gp_Trsf::Invert() - transformation has zero scale");
     scale = 1.0 / scale;
     loc.Multiply (-scale);
   }
   else {
-    Standard_Real As = scale;
-    if (As < 0) As = - As;
-    Standard_ConstructionError_Raise_if (As <= gp::Resolution(), "gp_Trsf::Invert() - transformation has zero scale");
+    Standard_ConstructionError_Raise_if (Abs(scale) <= gp::Resolution(), "gp_Trsf::Invert() - transformation has zero scale");
     scale = 1.0 / scale;
     matrix.Transpose ();
     loc.Multiply (matrix);