Skip to content

Commit e6dd7a3

Browse files
committed
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.
1 parent d4494e6 commit e6dd7a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/random_config.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ then
9393
fi
9494

9595
#Run valgrind 5% of the time (minus the asan cases)
96-
if [ "`seq 20 | shuf -n1`" -ne 1 -o "$sanitize" = "-fsanitize=address -fno-sanitize-recover=all" ]
96+
if [ "`seq 20 | shuf -n1`" -ne 1 -o "$sanitize" = "-fsanitize=address -fno-sanitize-recover=all" -o "$math" = "-ffast-math" ]
9797
then
9898
make check > makecheck_output.txt 2>&1
9999
else

0 commit comments

Comments
 (0)