Arnold Meijster wrote:
I will be teaching a course in C programming at the university
and was looking for a C compiler/interpreter that does
bound checking (for first year's students that seems to be a good idea).
After some googling, I found tcc. It seems to be perfect for what I
want, ...
Disclaimer: TCC's bound checking is not well tested and also the
algorithm is probably flawed in some aspects. It should work for
simple cases though.
[...]
As you can see, the boundschecking version is somewhat different; it
crashes instead of running on without any error (as without checking).
However, I don't think this is the behaviour to be expected, or is it?
Is expected. See lib/bcheck.c:
/* print a bound error message */
static void bound_error(const char *fmt, ...)
{
__bound_error_msg = fmt;
*(int *)0 = 0; /* force a runtime error */
}
Basically "-b" is meant to be used with "-run" where tcc prints
"__bound_error_msg" from its built-in exception handler:
$ tcc -b -run outofbound.c
You can also try the "btest" example, which runs the snippets in
tests/boundtest.c:
$ make -C tests btest
--- grischka
_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel