diff mbox

S390: Get rid of format warning in bug-vfprintf-nargs.c

Message ID m6mt4l$d7e$1@ger.gmane.org
State New
Headers show

Commit Message

Stefan Liebler Dec. 15, 2014, 3:01 p.m. UTC
On 12/12/2014 10:12 PM, Roland McGrath wrote:
> I think you can just cast the value to intptr_t.
>
Agreed.

Here is the new patch version.
Ok to commit?

---
2014-12-15  Stefan Liebler  <stli@linux.vnet.ibm.com>

	* stdio-common/bug-vfprintf-nargs.c (do_test):
	Cast value to intptr_t to avoid format warning
	for usage with PRIdPTR printing macro.

Comments

Roland McGrath Dec. 16, 2014, 5:51 p.m. UTC | #1
OK
diff mbox

Patch

diff --git a/stdio-common/bug-vfprintf-nargs.c b/stdio-common/bug-vfprintf-nargs.c
index c7e7f0b..7534967 100644
--- a/stdio-common/bug-vfprintf-nargs.c
+++ b/stdio-common/bug-vfprintf-nargs.c
@@ -65,7 +65,8 @@  do_test (void)
      test this on 32-bit systems.  */
   if (sizeof (long int) == 4)
     {
-      sprintf (buf, "%%1$d %%%" PRIdPTR "$d", UINT32_MAX / sizeof (int));
+      sprintf (buf, "%%1$d %%%" PRIdPTR "$d",
+	       (intptr_t) (UINT32_MAX / sizeof (int)));
       if (format_failed (buf, "1 %$d") != 0)
         rc = 1;
     }