|
|
|
|
|
by AlotOfReading
684 days ago
|
|
It's not my experience that C can be obviously free of UB and I'm curious to know how you approach that. I'm not aware of any methods or tools that claim to achieve it and there's a long history of "correct" programs written by experts were discovered to contain subtle UB with improvements in automated analysis. Here's one example, from Runtime Verification:
https://runtimeverification.com/blog/mare-than-14-of-sv-comp... |
|
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.