Close

A big fat bug in double/word division... lingering in the code for nearly 10 years!

A project log for eForth for cheap STM8S gadgets

Turn cheap modules from AliExpress into interactive development kits!

ThomasThomas 02/09/2021 at 17:310 Comments

What happens when a user tells you about a bug in a completely inconspicuous part of a software, one that you never touched and that you'd thought of as reliable since you'd been working with the software? It happened to me last week, and disbelieve was naturally my first reaction but the problem in UM/MOD, the "32/16bit-division-with-remainder" was real!

The same user quickly found a bug and provided a fix. I then informed the owner of another project, that started off of Dr. Ting's "STM8EF for the STM8S Discovery", also had never noticed any problem although he had identified and fixed another unrelated bug in UM/MOD!

What started then was a thorough analysis of the code, which unearthed yet another bug related to an edge case. Automated testing with a Python script makes more bugs in that code very unlikely.

The moral is this: bugs happen, and they can be very well hidden under other layers of code that "rescues" the expected behavior but open source software not only leads to much better testing for unexpected things but it can also make skilled teams appear out of thin air!

Discussions