Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CFG construction introduces wrong feature annotations on functions #37

Closed
clhunsen opened this issue Apr 14, 2015 · 2 comments
Closed

Comments

@clhunsen
Copy link
Contributor

In joint work with Stefan from Vienna and Thomas (@bockthom), we discovered that there is a bug in the --dumpcfg routine of TypeChef.

Consider following input file with an empty feature model:

void bar() {
}
void foo() {
#ifdef X
    bar();
#endif
}

As a sidenote, TypeChef (on 083e742, most recent commit on master) is called like this:

./typechef.sh /tmp/testsystem/foo4.c -o /tmp/testsystem/foo4.c --bdd --featureModelFExpr /tmp/testsystem/fm.txt --dumpcfg --lexNoStdout

From the example file, it is clear that the node for the function declaration of foo in the resulting control-flow graph is NOT annotated with a feature. Nevertheless, there is a feature annotation in the resulting graph:
foo4 c cfg dot

N;21;function;2;bar;1
E;21;21;1
E;21;21;1
N;42;statement;9;bar()::foo;definedEx(X)
E;42;21;definedEx(X)
N;63;function;7;foo;definedEx(X)
E;42;63;1
E;63;42;definedEx(X)
E;63;63;1

As you can see on the bold line, the function foo is annotated with definedEx(X) – instead of 1.
The other nodes and all the edges are fine, however.


I guess, the error results from a non-flushed temporary data structure. At least, it sounds like something of this kind.
Hopefully, someone, who is familiar with the code, can help on this problem.

Thanks in advance.

joliebig pushed a commit that referenced this issue Apr 18, 2015
@joliebig
Copy link
Collaborator

No, the error is caused by a bug in the dot-writer implementation. The annotation of the Stmt 8: bar() was used when writing node Function 6: foo.

The edge Function 6: foo -> Function 6: foo is wrong, too. It should be ! defined(x). Fixed this one also.

@clhunsen
Copy link
Contributor Author

Thanks for the fixes. I ran a test with the file, here the results:

foo4 c cfg dot

N;21;function;1;bar;1
E;21;21;1
E;21;21;1
N;42;statement;8;bar()::foo;definedEx(X)
E;42;21;definedEx(X)
N;63;function;6;foo;1
E;42;63;definedEx(X)
E;63;42;definedEx(X)
E;63;63;!definedEx(X)

The bold parts have changed. Looks good to me now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants