-
Notifications
You must be signed in to change notification settings - Fork 84
Run dead code analysis with reanalyze #737
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
Changes from all commits
711d37b
7a0f4df
948ab66
63c6c63
e3c0809
ca88fe4
7361f9b
1b2063e
bf917b5
9c283fc
cdae5fa
25d1e66
6b43d76
3bc7f42
bb324ad
d7088fd
e9bd890
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| +0 −50 | src/DTreeView.re | |
| +0 −29 | src/Menu.re | |
| +0 −20 | src/bindings/dOMParser.ml | |
| +0 −7 | src/bindings/dOMParser.mli | |
| +2 −1 | src/state/gvDisplay.ml | |
| +1 −1 | src/state/gvGoblint.ml | |
| +0 −8 | src/state/gvInspect.ml | |
| +1 −0 | src/state/gvMessages.ml | |
| +2 −2 | src/state/search.ml | |
| +0 −8 | src/ui/base/form.re | |
| +0 −37 | src/ui/base/mappedInput.re | |
| +1 −0 | src/utils/httpClient.ml | |
| +0 −59 | src/utils/xml.ml | |
| +0 −15 | src/utils/xmlParser.ml |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| module Addr = ValueDomain.Addr | ||
| module Offs = ValueDomain.Offs | ||
| module AD = ValueDomain.AD | ||
| module Exp = Exp.Exp | ||
| module Exp = CilType.Exp | ||
| module LF = LibraryFunctions | ||
| open Prelude.Ana | ||
| open Analyses | ||
|
|
@@ -109,6 +109,27 @@ struct | |
| | CastE (t1,e1), CastE (t2,e2) -> typ_equal t1 t2 && exp_equal e1 e2 | ||
| | _ -> false | ||
|
|
||
| (* TODO: what does interesting mean? *) | ||
| let rec interesting x = | ||
| match x with | ||
| | SizeOf _ | ||
| | SizeOfE _ | ||
| | SizeOfStr _ | ||
| | AlignOf _ | ||
| | AlignOfE _ | ||
| | UnOp _ | ||
| | BinOp _ -> false | ||
| | Const _ -> true | ||
| | AddrOf (Var v2,_) | ||
| | StartOf (Var v2,_) | ||
| | Lval (Var v2,_) -> true | ||
| | AddrOf (Mem e,_) | ||
| | StartOf (Mem e,_) | ||
| | Lval (Mem e,_) | ||
| | CastE (_,e) -> interesting e | ||
| | Question _ -> failwith "Logical operations should be compiled away by CIL." | ||
| | _ -> failwith "Unmatched pattern." | ||
|
|
||
| (* helper to decide equality *) | ||
| let query_exp_equal ask e1 e2 g s = | ||
| let e1 = constFold false (stripCasts e1) in | ||
|
|
@@ -119,6 +140,7 @@ struct | |
| | _ -> false | ||
|
|
||
| (* kill predicate for must-equality kind of analyses*) | ||
| (* TODO: why unused? how different from below? *) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They seem to be virtually identical, except the one below being a fair bit more chaotic. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess it might have been copied there, but without completely rewriting this all, I'd rather not touch this analysis more than necessary. |
||
| let may_change_t (b:exp) (a:exp) : bool = | ||
| let rec type_may_change_t a bt = | ||
| let rec may_change_t_offset o = | ||
|
|
@@ -151,6 +173,7 @@ struct | |
| let bt = unrollTypeDeep (Cilfacade.typeOf b) in | ||
| type_may_change_t a bt | ||
|
|
||
| (* TODO: why unused? how different from below? *) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They are very similar, but the code below handles more cases, but is also considerably more weird. |
||
| let may_change_pt ask (b:exp) (a:exp) : bool = | ||
| let pt e = ask (Queries.MayPointTo e) in | ||
| let rec lval_may_change_pt a bl : bool = | ||
|
|
@@ -377,7 +400,7 @@ struct | |
| *) let lvt = unrollType @@ Cilfacade.typeOfLval lv in | ||
| (* Messages.warn ~msg:(sprint 80 (d_type () lvt)) (); *) | ||
| if is_global_var ask (Lval lv) = Some false | ||
| && Exp.interesting rv | ||
| && interesting rv | ||
| && is_global_var ask rv = Some false | ||
| && ((isArithmeticType lvt && match lvt with | TFloat _ -> false | _ -> true ) || isPointerType lvt) | ||
| then D.add_eq (rv,Lval lv) (remove ask lv st) | ||
|
|
@@ -387,7 +410,7 @@ struct | |
| | Lval rlval -> begin | ||
| match ask (Queries.MayPointTo (mkAddrOf rlval)) with | ||
| | rv when not (Queries.LS.is_top rv) && Queries.LS.cardinal rv = 1 -> | ||
| let rv = Exp.of_clval (Queries.LS.choose rv) in | ||
| let rv = Lval.CilLval.to_exp (Queries.LS.choose rv) in | ||
| if is_local lv && Exp.is_global_var rv = Some false | ||
| then D.add_eq (rv,Lval lv) st | ||
| else st | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| open Cil | ||
| open Pretty | ||
| open IntOps | ||
| let fast_addr_sets = false (* unknown addresses for fast sets == top, for slow == {?}*) | ||
|
|
||
| module GU = Goblintutil | ||
| module M = Messages | ||
|
|
@@ -41,7 +40,6 @@ struct | |
| let unknown_ptr = singleton Addr.UnknownPtr | ||
| let not_null = unknown_ptr | ||
| let top_ptr = of_list Addr.([UnknownPtr; NullPtr]) | ||
| let is_unknown x = is_element Addr.UnknownPtr x | ||
| let may_be_unknown x = exists (fun e -> e = Addr.UnknownPtr) x | ||
| let is_null x = is_element Addr.NullPtr x | ||
| let is_not_null x = for_all (fun e -> e <> Addr.NullPtr) x | ||
|
|
@@ -117,6 +115,7 @@ struct | |
| | false, false -> join x y | ||
| *) | ||
|
|
||
| (* TODO: overrides is_top, but not top? *) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that is some kind of hack to avoid the creation of top addresses as this will fail from let top_ptr = of_list Addr.([UnknownPtr; NullPtr])There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose it's weird because there isn't just a single value that this |
||
| let is_top a = mem Addr.UnknownPtr a | ||
|
|
||
| let merge uop cop x y = | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.