Skip to content

[libc] Fix sprintf FixedConv test #98204

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

Conversation

mikhailramalho
Copy link
Member

Similar to #98195.

This patch enlarges the number to ensure that a 64-bit number is being read.

@llvmbot
Copy link
Member

llvmbot commented Jul 9, 2024

@llvm/pr-subscribers-libc

Author: Mikhail R. Gadelha (mikhailramalho)

Changes

Similar to #98195.

This patch enlarges the number to ensure that a 64-bit number is being read.


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

1 Files Affected:

  • (modified) libc/test/src/stdio/sprintf_test.cpp (+4-4)
diff --git a/libc/test/src/stdio/sprintf_test.cpp b/libc/test/src/stdio/sprintf_test.cpp
index 7ccc0a2652e2b..de389e032f895 100644
--- a/libc/test/src/stdio/sprintf_test.cpp
+++ b/libc/test/src/stdio/sprintf_test.cpp
@@ -3351,7 +3351,7 @@ TEST_F(LlvmLibcSPrintfTest, FixedConv) {
       LIBC_NAMESPACE::sprintf(buff, "%hR", 0xff); // unsigned short fract max
   ASSERT_STREQ_LEN(written, buff, "0.996094");
 
-  written = LIBC_NAMESPACE::sprintf(buff, "%lk", 0x0); // 0.0
+  written = LIBC_NAMESPACE::sprintf(buff, "%lk", 0x0ll); // 0.0
   ASSERT_STREQ_LEN(written, buff, "0.000000");
 
   written = LIBC_NAMESPACE::sprintf(buff, "%lk",
@@ -3365,7 +3365,7 @@ TEST_F(LlvmLibcSPrintfTest, FixedConv) {
                                     0xffffffff); //-long fract max
   ASSERT_STREQ_LEN(written, buff, "-1.000000");
 
-  written = LIBC_NAMESPACE::sprintf(buff, "%lK", 0x0); // 0.0
+  written = LIBC_NAMESPACE::sprintf(buff, "%lK", 0x0ll); // 0.0
   ASSERT_STREQ_LEN(written, buff, "0.000000");
 
   written =
@@ -3493,8 +3493,8 @@ TEST_F(LlvmLibcSPrintfTest, FixedConv) {
   ASSERT_STREQ_LEN(written, buff, "       0.100 256.000     ");
 
   written =
-      LIBC_NAMESPACE::sprintf(buff, "%+-#12.3lk % 012.3k", 0x000000001013a92a,
-                              0x02740000); // 0.126, 1256.0
+      LIBC_NAMESPACE::sprintf(buff, "%+-#12.3lk % 012.3k", 0x000000001013a92all,
+                              0x02740000ll); // 0.126, 1256.0
   ASSERT_STREQ_LEN(written, buff, "+0.126        0001256.000");
 }
 #endif // defined(LIBC_COMPILER_HAS_FIXED_POINT) &&

Similar to llvm#98195.

This patch enlarges the number to ensure that a 64-bit number is being
read.
@mikhailramalho mikhailramalho force-pushed the fix-sprintf-fixedconv-test branch from a2223bd to 6af66c3 Compare July 9, 2024 20:17
@mikhailramalho mikhailramalho merged commit 9e0347d into llvm:main Jul 9, 2024
4 of 5 checks passed
@mikhailramalho mikhailramalho deleted the fix-sprintf-fixedconv-test branch July 9, 2024 20:21
aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this pull request Jul 14, 2024
This patch enlarges the number to ensure that a 64-bit number is being read.
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