Had the strangest bug today.
During Computer Architecture labs we were supposed to write utterly trivial distributed app using PVM (Parallel Virtual Machine or something) libs. And so we did. All was nice and dandy, app would spawn worker processes, send them data (that is, 3 integers) which would then get summed and sent back to master process. Everything was cool, working set was split into correct number of messages, each was sent correctly, replies sent back, except that the very last one just wasn't making it. It would simply disappear into oblivion, leaving parent process hanging there ad infinitum.
Obviously we debugged it, added some control printf()s (debugging distributed app on remote site with no gdb installed isn't nice in general, but this one was hopefully trivial enough to only need couple of printf()s here and there), corrected few obvious mistakes and, umm, nothing. It would just hang there. So we got LA (Laboratory Assistant) to take a look at it if we didn’t make any stupid mistake in PVM code. Nope. All clear and correct. We tried fiddling with size of data and number of child process – now it ran to the end and exited cleanly, but results were clearly bogus. Change back to old settings – hang.
So, we analysed it over and over, checked the algo several times, nothing. During random bashing of debug printf()s, I moved one few lines down in the code to get it to print slightly different set of data, and then – *poof*, it just worked. I moved exactly 1 (one) printf(). It changed no control flow. But suddenly, the app just worked. When I got the printf() back into old position, it still worked. The untraceable bug just disappeared, appropriately, without trace.
Update: So advogato doesn't allow <acronym></acronym>. Grrr