On Saturday, October 22, 2022 at 7:51:45 PM UTC-7, Hans-Peter Diettrich wrote:
(snip)
Post by Hans-Peter DiettrichIsn't it good practice to maintain a test suite at least for compilers,
that contains both selected valid and invalid code snippets?
For error reports on obviously weird input I'd prepare an equally weird
answer ;-)
The only one I know that actually, really, did that was TeX.
There is a test program that is supposed to execute all code
except for fatal errors.
To do that, you need some type of flow analysis to figure out which
parts of the program are, and especially are not, being executed.
The figure out what to add to the input to execute those that aren't.
I don't think I am quite as good now, but in my early programming days,
I had a tendency to try out features just to try them out, and often enough
find bugs that no-one thought about before.
The only one I can remember now is using ++ in C on a double variable.
There is no rule against using it on floating point types, but it seems that
compiler writers aren't so good at testing it.
[There are certainly code coverage tools that are supposed to let you exercise
all of the code in a program. Again, not just compilers. -John]