]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
mips: finetune none/tests/(mips32|64)/test_math test
authorPetar Jovanovic <mips32r2@gmail.com>
Fri, 15 Sep 2017 16:29:29 +0000 (18:29 +0200)
committerPetar Jovanovic <mips32r2@gmail.com>
Fri, 15 Sep 2017 16:29:29 +0000 (18:29 +0200)
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.

none/tests/mips32/test_math.cpp

index 8a0f2dcab60f59772a06bbebd492d63fe12695e2..3d724d3a9b74b9865de1c6a1a47d723551bbd276 100644 (file)
@@ -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.