Bug in 64-bit printf on PPC

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Thu Apr 1 00:00:00 GMT 1999


Hi,

this little program:

#include <stdio.h>

int main()
{
    printf("%llx\n",0xffff00000000208bULL);
    printf("%llu\n",0xffff00000000208bULL);

    printf("%llx\n",18446462598732849291ULL);
    printf("%llu\n",18446462598732849291ULL);

    printf("%llx\n",18359476226655002763ULL);
    printf("%llu\n",18359476226655002763ULL);

    return 0;
}

results on PPC in:
ffff00000000208b
18359476226655002763
ffff00000000208b
18359476226655002763
fec9f65b0000208b
18278463854511923339

which is wrong for the %llu cases. On x86 this program outputs:

ffff00000000208b
18446462598732849291
ffff00000000208b
18446462598732849291
fec9f65b0000208b
18359476226655002763

which is correct.
This should probably be added to the testsuite.

Franz.



More information about the Libc-alpha mailing list