[cc65] printf: oops :-)

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2013-07-22 00:50:15
Good evening!

Some may remember that there was a problem with printf reported a long time
ago. I got curious and over the weekend, I wrote a program to test printf. Or
better: The underlying formatting code, which is used for the whole printf()
family of functions including cprintf and sprintf.

The result is what made me say "oops": The program tests 377 different
conversions. The cc65 printf implementation fails in 144 cases. In 31 of these
cases, it fails so badly that it outputs screens of garbage, or even crashes
the machine, so I had to disable these tests to proceed.

What that means is: be careful with printf and friends. If anybody wants to
have a look at the test code:


Please note that you can compile the code with gcc for x86, but it will show
failures. This is because the expected results are hardcoded and the integer
sizes of gcc are different, so the conversion results won't match the ones
expected in the code.



Ullrich von Bassewitz                                  uz@musoftware.de
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Jul 22 00:50:22 2013

This archive was generated by hypermail 2.1.8 : 2013-07-22 00:50:24 CEST