When I use the frama-c analysis my c program. It seems there exits a bug in the impact plug in of the frama-c. This is my program.
#include<stdio.h>
int global;
int main()
{
global = 12;
int result = 0;
if(global > 1)
{
result += 100;
}
else
{
result += 200;
}
return 0;
}
I want to find all the stataments impacted by the variable “global”.
Obviously, the statement “result += 100;” in the scope of “if condition” which is related to the variable “global”, so the statement “result += 100;” should be high light.
However, the running result seems not correct.
I’m assuming that you have used no special option, and that you have started the impact analysis in Frama-C’s GUI, on the statement
global = 12. If it is not the case, please provide more detailed instructions.In your program, the
if (global > 1)instruction gets selected because there is a data dependency to the statementglobal = 12. However, the statementresult += 100does not get selected by the Impact plugin. This is the intended behavior, because there is no control dependency in this case. Notice that theelsebranch of theifis dead. Thus, the execution ofresult += 100does not really depend on the evaluation ofif (global > 1), as the condition is always true. As the control flow always reachesresult += 100instruction, no control dependency exists.If you want to exhibit a control dependency in this example, the simplest way consists in changing your line
global = 12intoand to add the file
$(SHARE)/frama-C/libc/__fc_builtin.cto the command-line. The two instructionsresult += 100andresult += 200will get selected, in each case because of a control dependency.