From 0fd953c217d4cb042ea9521a2bfce7683eb6e915 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Tue, 24 May 2016 21:55:46 +0200 Subject: Workaround clang/llvm bug in code generation. --- test/geo_transformations.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'test/geo_transformations.cpp') diff --git a/test/geo_transformations.cpp b/test/geo_transformations.cpp index 48393a5c6..2e3a7169a 100644 --- a/test/geo_transformations.cpp +++ b/test/geo_transformations.cpp @@ -18,6 +18,10 @@ Matrix angleToVec(T a) return Matrix(std::cos(a), std::sin(a)); } +// This permits to workaround a bug in clang/llvm code generation. +EIGEN_DONT_INLINE +void dont_over_optimize(void* x) { *(int*)(x) = (*(int*)(x))&0xFFFF000 | (*(int*)(x))&0x0000FFFF; } + template void non_projective_only() { /* this test covers the following files: @@ -224,12 +228,13 @@ template void transformations() do { v3 = Vector3::Random(); + dont_over_optimize(&v3); } while (v3.cwiseAbs().minCoeff()::epsilon()); Translation3 tv3(v3); Transform3 t5(tv3); t4 = tv3; VERIFY_IS_APPROX(t5.matrix(), t4.matrix()); - t4.translate(-v3); + t4.translate((-v3).eval()); VERIFY_IS_APPROX(t4.matrix(), MatrixType::Identity()); t4 *= tv3; VERIFY_IS_APPROX(t5.matrix(), t4.matrix()); -- cgit v1.2.3