This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix tst-sscanf and tst-swscanf on 64-bit


In the glibc-2.19 port status entry for sparc 64-bit I indicated
that these two tests get a bus error, and I just figured out why.

The dummy variable passed to sscanf() in the int_tests[] run needs
to be at least as large as a pointer.

MIPS 64-bit was probably failing in an identical way.  It will fail on
any 64-bit platform where unaligned accesses generate an exception.

Ok to commit?

2014-02-05  David S. Miller  <davem@davemloft.net>

	* stdio-common/tst-sscanf.c (main): Use 'long' for 'dummy' when
	processing int_tests.

diff --git a/stdio-common/tst-sscanf.c b/stdio-common/tst-sscanf.c
index 1214c7d..9fef93a 100644
--- a/stdio-common/tst-sscanf.c
+++ b/stdio-common/tst-sscanf.c
@@ -186,7 +186,8 @@ main (void)
 
   for (i = 0; i < sizeof (int_tests) / sizeof (int_tests[0]); ++i)
     {
-      int dummy, ret;
+      long dummy;
+      int ret;
 
       if ((ret = SSCANF (int_tests[i].str, int_tests[i].fmt,
 			 &dummy)) != int_tests[i].retval)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]