Skip to content

[libc] Fix math fuzzers #101529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 1, 2024
Merged

Conversation

michaelrj-google
Copy link
Contributor

Fix minor typos that accumulated while the math fuzzers were disabled.

Fix minor typos that accumulated while the math fuzzers were disabled.
@llvmbot llvmbot added the libc label Aug 1, 2024
@llvmbot
Copy link
Member

llvmbot commented Aug 1, 2024

@llvm/pr-subscribers-libc

Author: Michael Jones (michaelrj-google)

Changes

Fix minor typos that accumulated while the math fuzzers were disabled.


Full diff: https://github.com/llvm/llvm-project/pull/101529.diff

2 Files Affected:

  • (modified) libc/fuzzing/math/RemQuoDiff.h (+3-3)
  • (modified) libc/fuzzing/math/nextafter_differential_fuzz.cpp (+2)
diff --git a/libc/fuzzing/math/RemQuoDiff.h b/libc/fuzzing/math/RemQuoDiff.h
index cfb9b7f44e548..6fdc02e6e6a2f 100644
--- a/libc/fuzzing/math/RemQuoDiff.h
+++ b/libc/fuzzing/math/RemQuoDiff.h
@@ -34,13 +34,13 @@ void RemQuoDiff(RemQuoFunc<T> func1, RemQuoFunc<T> func2, const uint8_t *data,
   LIBC_NAMESPACE::fputil::FPBits<T> bits1(remainder1);
   LIBC_NAMESPACE::fputil::FPBits<T> bits2(remainder2);
 
-  if (bit1.is_nan()) {
-    if (!bit2.is_nan())
+  if (bits1.is_nan()) {
+    if (!bits2.is_nan())
       __builtin_trap();
     return;
   }
 
-  if (bit1.is_inf() != bit2.is_inf())
+  if (bits1.is_inf() != bits2.is_inf())
     __builtin_trap();
 
   // Compare only the 3 LS bits of the quotient.
diff --git a/libc/fuzzing/math/nextafter_differential_fuzz.cpp b/libc/fuzzing/math/nextafter_differential_fuzz.cpp
index 2e6d58995a31f..e48ef51d54807 100644
--- a/libc/fuzzing/math/nextafter_differential_fuzz.cpp
+++ b/libc/fuzzing/math/nextafter_differential_fuzz.cpp
@@ -17,6 +17,8 @@
 #include "src/math/nextafterf.h"
 #include "src/math/nextafterl.h"
 
+#include <math.h>
+
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   TwoInputSingleOutputDiff<float, float>(&LIBC_NAMESPACE::nextafterf,
                                          &::nextafterf, data, size);

Copy link
Contributor

@RoseZhang03 RoseZhang03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@michaelrj-google michaelrj-google merged commit 3497211 into llvm:main Aug 1, 2024
6 of 7 checks passed
@michaelrj-google michaelrj-google deleted the libcMathFuzzerFix branch August 1, 2024 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants