summaryrefslogtreecommitdiff
path: root/src/tools/fuzzing.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-09-21 17:23:03 -0700
committerGitHub <noreply@github.com>2020-09-21 17:23:03 -0700
commit4b3c35b34c62dc619b1c706e5562e90c089f2419 (patch)
tree904ccadc6e8b7a05a05a7ebba01a65b87eb7ff94 /src/tools/fuzzing.h
parent85e0e50e86797d63912742c1c2aac0332dd2cf40 (diff)
downloadbinaryen-4b3c35b34c62dc619b1c706e5562e90c089f2419.tar.gz
binaryen-4b3c35b34c62dc619b1c706e5562e90c089f2419.tar.bz2
binaryen-4b3c35b34c62dc619b1c706e5562e90c089f2419.zip
Fuzz with negative zero more often (#3133)
We did so earlier sometimes, as we would pick 0 and then tweak it with a negation. But that favored positive 0. This makes coverage symmetric.
Diffstat (limited to 'src/tools/fuzzing.h')
-rw-r--r--src/tools/fuzzing.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h
index 7ef24bbac..cab33e3b5 100644
--- a/src/tools/fuzzing.h
+++ b/src/tools/fuzzing.h
@@ -1699,7 +1699,8 @@ private:
std::numeric_limits<uint64_t>::max()));
break;
case Type::f32:
- value = Literal(pick<float>(0,
+ value = Literal(pick<float>(0.0f,
+ -0.0f,
std::numeric_limits<float>::min(),
std::numeric_limits<float>::max(),
std::numeric_limits<int32_t>::min(),
@@ -1710,7 +1711,8 @@ private:
std::numeric_limits<uint64_t>::max()));
break;
case Type::f64:
- value = Literal(pick<double>(0,
+ value = Literal(pick<double>(0.0,
+ -0.0,
std::numeric_limits<float>::min(),
std::numeric_limits<float>::max(),
std::numeric_limits<double>::min(),