From 1411e2e85bb8879a5f50d2e43bd7f8173be57667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 4 Jun 2016 20:39:37 +0200 Subject: [PATCH] Math: work around GCC 4.9 crash in Android NDK. Seems to be only in case of this particular function in the test and nowehere else. Won't bother investigating further. --- src/Magnum/Math/Test/QuaternionTest.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Magnum/Math/Test/QuaternionTest.cpp b/src/Magnum/Math/Test/QuaternionTest.cpp index 4addf3c40..9aee96466 100644 --- a/src/Magnum/Math/Test/QuaternionTest.cpp +++ b/src/Magnum/Math/Test/QuaternionTest.cpp @@ -399,6 +399,13 @@ void QuaternionTest::matrix() { CORRADE_COMPARE(Quaternion::fromMatrix(m4), q4); } +/* The crappy 4.9 20140827 (prerelease) in Android NDK segfaults when + optimizing the following function. Dialing down the optimization helps. No + problem when calling Math::lerp() anywhere else, so I won't dig further. + Fuck this. */ +#if defined(CORRADE_TARGET_ANDROID) && __GNUC__*100 + __GNUC_MINOR__*10 + __GNUC_PATCHLEVEL__ == 490 +#pragma GCC push_options +#pragma GCC optimize("O0") void QuaternionTest::lerp() { Quaternion a = Quaternion::rotation(Deg(15.0f), Vector3(1.0f/Constants::sqrt3())); Quaternion b = Quaternion::rotation(Deg(23.0f), Vector3::xAxis()); @@ -416,6 +423,8 @@ void QuaternionTest::lerp() { Quaternion lerp = Math::lerp(a, b, 0.35f); CORRADE_COMPARE(lerp, Quaternion({0.119127f, 0.049134f, 0.049134f}, 0.990445f)); } +#pragma GCC pop_options +#endif void QuaternionTest::slerp() { Quaternion a = Quaternion::rotation(Deg(15.0f), Vector3(1.0f/Constants::sqrt3()));