|
|
|
|
|
by uecker
678 days ago
|
|
For example, the following function has obviously no UB: unsigned int mul(unsigned int x, unsigned int y)
{
return x * y;
} Or there are many high level function structures as, which also has no UB (with some assumption on the called functions): void bar()
{
struct foo *p = foo_alloc();
foo_do1(p);
foo_do2(p);
foo_delete(p);
} Such code can be easily screened and also this can be done automatically. There is a lack of open-source which can do this, but I have an experimental GCC branch which starts to do this and looks promising. |
|
> Such code can be easily screened and also this can be done automatically.
That doesn't sound right at all. Robust static analysis of C code is extremely involved. It's an area of ongoing research.
Prior efforts along these lines have not been successful. Even adopting the MISRA C ruleset doesn't guarantee absence of undefined behaviour, for instance.