-
Notifications
You must be signed in to change notification settings - Fork 135
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
Simple miss-sliced examples? #384
Comments
The code generated by
The superfluous lines are there because DG does not support C++ and thus it over-approximates the behavior of the program. This over-approximation leads to bigger slices. |
Thanks @mchalupa for the quick response! Two follow-ups:
Thanks! |
Probably yes, but hard to tell... maybe some global initialization? However, if you need a compilable C code, you can use a tool like rellic, llvm2c, or llvm-cbe to transform the sliced LLVM to C (I do not know how is it with the support of C++ in these tools).
In the presence of exceptions in the program or some functions that may abort inside libstdc++, the program may also fail running. In other cases, it should be just over-approximation -- but it is not tested at all. |
Hi,
As far as I understand, I'm getting some miss-sliced examples. I'm unsure whether it's a bug or I'm violating a pre-condition of dg:
Example 1
Code
Command: dg/tools/dgtool llvm-slicer -Xclang -g -c 21:C -cda ntscd -annotate slice hello.cpp -statistics -dump-dg && dg/tools/llvm-to-source hello.sliced hello.cpp
Result:
Problem: The code wouldn't compile (s and v are not declared) and s isn't relevant to A.
Example 2:
Code
Command dg/tools/dgtool llvm-slicer -Xclang -g -c 20:C -cda ntscd -annotate slice hello.cpp -statistics -dump-dg && dg/tools/llvm-to-source hello.sliced hello.cpp
Result
Problem: lines 6,7,8 are superfluous. It's missing the #include and the using namespace (that's fine)
If I'm doing something wrong or running into problems with dg, is there a work-around? Thanks!
The text was updated successfully, but these errors were encountered: