shithub: opus

Download patch

ref: e6dd7a3de4237e2bf5762e537c57696110a5fbcf
parent: d4494e6ed7d564cbee3cfdfe41d0c0989c4345ff
author: Jean-Marc Valin <jeanmarcv@google.com>
date: Wed Mar 26 10:59:02 EDT 2025

Do not run valgrind on -ffast-math builds

valgrind does not properly handle the Denormals-Are-Zero (DAZ) flag,
which can be set by -ffast-math. That would not generally be a problem
except when the compiler implements sqrt(x) as x*rsqrt(x) with an
exception for x=0. In that case, when x is a non-zero denorm value,
the exception does not trigger with valgrind (but does on real
hardware), which causes the sqrt to evaluate to -inf instead of 0.

--- a/tests/random_config.sh
+++ b/tests/random_config.sh
@@ -93,7 +93,7 @@
 fi
 
 #Run valgrind 5% of the time (minus the asan cases)
-if [ "`seq 20 | shuf -n1`" -ne 1 -o "$sanitize" = "-fsanitize=address -fno-sanitize-recover=all" ]
+if [ "`seq 20 | shuf -n1`" -ne 1 -o "$sanitize" = "-fsanitize=address -fno-sanitize-recover=all" -o "$math" = "-ffast-math" ]
 then
         make check > makecheck_output.txt 2>&1
 else
--