Here are my experimental C flow tests using Coccinelle tool.
Please see https://coccinelle.gitlabpages.inria.fr/website/
Tested environment:
- OS: Debian 11, Apr 2023
- Installed packages:
sudo apt-get install coccinelle graphviz gv
Future environment:
- OS: Fedora 38, Apr 2023
- Installed packages:
sudo dnf install coccinelle graphviz gv
List of projects:
lock-ex1/
- simple locking example without preprocessor macros. Any call ofacquire_lock()
must be followed withrelease_lock()
just before return. This example works properly.lock-ex2
- example with macros - problem is when modified statements are part of macro (it will fail) - in our case the problem is caused when we need to modifyreturn
statement.lock-ex3
- using just functions without macro definition. There is problem that Coccinelle does not known thatmy_return(x)
that looks like function is actually macro ending withreturn(x);
which affects execution flow significantly. Thus legit code may throw error:ret_wo_release: node 24: return ...[1,2,10] in ok_with_branch \ reachable by inconsistent control-flow paths