-
Notifications
You must be signed in to change notification settings - Fork 20
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
When a function is annotated @dead
values inside it are reported dead.
#156
Comments
If the annotations added are incorrect, there's no way this is going to be idempotent. |
The case of #155 is the odd one out here. I think all the other cases were such that if an unused function was correctly annotated with |
There's some logic that if a function is reported dead, then the values inside it are not reported. I thought this was done for a reason, but not sure might be bad memory. As an aside, in interactive use, you would annotate the function as |
I think I now remember that idempotency is tested by running a ppx which deletes the entire function when annotated dead, so that's the sense in which it is idempotent. The values inside won't be reported as they disappear. So in this sense, the process makes sense if one proceeds by either:
I think this process is reasonable, so I'd be inclined to consider this as a non-issue. |
So I would say that the issue is about documenting what the intended process is, rather than the current behaviour. |
If the intended process only involves using
According to that, there is legitimate reason for keeping I understand the difference of the two annotations as to their transitive behavior, but there's a subtlety in the phrase "values they use". For example, in the snippet from above: let print_to_file (fileName: string) (fileAST: file) =
let oc = Stdlib.open_out fileName [@@dead "+oc"] in
dumpFile defaultCilPrinter oc fileName fileAST [@@dead "+print_to_file"] It's about a dead function Or if in such dead containment case it is really expected to use the |
It's pretty tempting to remove the entire concept of Except, one loses the fact that annotated code still compiles and does not code rot while refactoring. |
That would be pretty noisy. Looks like proper idempotency is the way to go. It's only a minor code complication where dead-annotated declarations are not filtered out early on, but survive until it's time to report things. And they won't be reported but be used to silence inner reports. |
This should take care of it: #160 |
-write
are not always idempotent@dead
valued inside it are reported dead.
@dead
valued inside it are reported dead.@dead
values inside it are reported dead.
Running reanalyze 389dd68 on Goblint goblint/analyzer@a544002 revealed the following.
Going through the following steps:
dune build @check @all
to get cmt files.reanalyze.exe -write -dce-cmt _build/default/
prints:dune build @check @all
to get cmt files with written attributes.reanalyze.exe -write -dce-cmt _build/default/
prints:Even though the first analysis adds dead code attributes, the second analysis just keeps on adding more. For example:
oc
, despite it being contained inprint_to_file
, which has the attribute from the first run:The text was updated successfully, but these errors were encountered: