The Stupidest Question I have ever heard at a Computer Science presentation
By pascal on Tuesday, May 31 2011, 23:34 - Permalink
Some time back, I reported a Csmith bug against the last git version. This is in no way a rant against Csmith, a fine piece of engineering. Csmith does something that I would not have thought possible if you had asked me before I saw it: it generates random C programs that are both free of undefined behavior and varied enough to uncover a ton of bugs in the C-accepting program you pipe it into.
Unless the C-accepting program is CompCert, in which case you only uncover a couple of bugs, apparently.
Bugs in random programs have a funny way to find themselves. You don't need to try many inputs, as the random program explores these for you. Even if you think you are being quite the conservative user, they pop up uninvited from time to time (although, to be fair, you can see that they are being fixed because they pop up less and less frequently). Anyway, dangling pointers were being passed as arguments to functions that didn't use them, although I was not using the option that allows this behavior in generated programs. This was my bug. It had been good company, but I didn't feel ready for a long-term relationship. It was time to let go.
Fast forward a few days, and there is this promising commit on github. I decide I may as well upgrade, although the bug was only appearing from time to time because I had fiddled with the parameters in a way that made it more likely to appear, and I had not seen it at all since I had fiddled with the parameters again.
Suddenly, as I re-compile, with GCC, this program generator that finds bugs in GCC, I am reminded of the stupidest question I ever heard at the end of a computer science presentation.
Like many bad questions, this question was more a remark than a question. Adapted to the present context, it would go like this:
It doesn't make sense to use Csmith find bugs in C compilers, since it is itself compiled with a C (technically, C++) compiler.
Apparently, as a physics student, much earlier, the asker had been chided for using a pendulum-based chronometer to verify the constancy of a pendulum's period.
So, if I may be so bold as to impart my own wisdom to the world in the form of random remarks, there are two lessons in this post. "Be careful of circular reasoning" is one, but "software is not quite as similar to the physical world as you could expect" is another.