[PATCH] _store_inttype is broken for x86_64

Atsushi Nemoto anemo at mba.ocn.ne.jp
Fri Jan 26 10:32:40 UTC 2007


On Wed, 24 Jan 2007 09:07:59 -0600, Roman Kononov <roman at xtremedatainc.com> wrote:
> To confirm that this is a bug try this on x86_64:
> 
> int main() {
>      unsigned long long val=~0ull;
>      sscanf("123456789","%Lx",&val);
>      printf("val=%Lx\n");
>      return 0;
> }

printf("val=%Lx\n", val), perhaps? ;-)

> It will show "val=ffffffff23456789"
> 
> The patch fixes this.

I confirmed mips64el (n64 ABI) has same problem and your patch fixes
it.  Thanks.

> Index: libc/stdio/_store_inttype.c
> ===================================================================
> --- libc/stdio/_store_inttype.c (revision 17475)
> +++ libc/stdio/_store_inttype.c (working copy)
> @@ -35,7 +35,7 @@
>                  *((unsigned char *) dest) = val;
>                  return;
>          }
> -#if defined(LLONG_MAX) && (LONG_MAX != LLONG_MAX)
> +#if defined(LLONG_MAX) && (LLONG_MAX != INT_MAX)

Your mailer converted TAB with spaces, so I had to apply it manually.
Please check your configuration.


BTW, does x86_64 can print 64-bit pointer with printf %p properly?
If no, could you try it?

http://www.uclibc.org/lists/uclibc/2006-November/016736.html

---
Atsushi Nemoto



More information about the uClibc mailing list