From: Petar Jovanovic Date: Fri, 15 Sep 2017 16:29:29 +0000 (+0200) Subject: mips: finetune none/tests/(mips32|64)/test_math test X-Git-Tag: VALGRIND_3_14_0~259 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4f2fdfa4b242b5af17321d512939a267152cd56;p=thirdparty%2Fvalgrind.git mips: finetune none/tests/(mips32|64)/test_math test Compiler may optimize out call to cbrt. Change test to prevent that. Otherwise, the test does not exercise a desired codepath for cbrt, and it prints precalculated value. --- diff --git a/none/tests/mips32/test_math.cpp b/none/tests/mips32/test_math.cpp index 8a0f2dcab6..3d724d3a9b 100644 --- a/none/tests/mips32/test_math.cpp +++ b/none/tests/mips32/test_math.cpp @@ -10,6 +10,8 @@ static void DivideByZero() { volatile float result __attribute__((unused)) = 123.0f / zero; } +volatile double cube = 27.0; + int main () { /* Testing lrint. */ fesetround(FE_UPWARD); // lrint/lrintf/lrintl obey the rounding mode. @@ -100,7 +102,7 @@ int main () { printf("tgamma(5.0): %lf\n", tgamma(5.0)); /* Test cbrt. */ - printf("cbrt(27.0): %lf\n", cbrt(27.0)); + printf("cbrt(27.0): %lf\n", cbrt(cube)); /* Test dividing by zero. */ // Clearing clears.