|
From: Petar J. <pe...@so...> - 2017-09-15 16:34:30
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=e4f2fdfa4b242b5af17321d512939a267152cd56 commit e4f2fdfa4b242b5af17321d512939a267152cd56 Author: Petar Jovanovic <mip...@gm...> Date: Fri Sep 15 18:29:29 2017 +0200 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: --- none/tests/mips32/test_math.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/none/tests/mips32/test_math.cpp b/none/tests/mips32/test_math.cpp index 8a0f2dc..3d724d3 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. |