Sunday, January 22, 2006

Random compiler tester finds first bug

Doug Coleman's random compiler tester managed to generate a very large number of failing test cases, which are all found to be symptoms of the same bug: the overflow check for the fixnum-shift primitive was wrong, thus certain large negative fixnums, when shifted to the left, would not be upgraded to a bignum and instead overflow, Java-style. This bug manifested itself on x86 in a pretty bad way: because the x86 assembler uses bit shifting to assemble instructions, large negative literal fixnums in colon definitions would not compile correctly. This bug would have been hard to discover by hand since it is rare to find literal integers in code, other than the usual 0, -1, 1 and 2. Now the overflow bug is fixed.

Factor 0.80 already has a large number of fixes for compiler bugs which I found with manual testing, and now that we have an automated test case generator, I hope it finds many more. :)

No comments: