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

Relational: Assert type bounds after branch #1698

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/analyses/apron/relationAnalysis.apron.ml
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ struct
RD.assert_inv ask rel' e' (not b) (no_overflow ask e)
)
in
let vars = Basetype.CilExp.get_vars e |> List.unique ~eq:CilType.Varinfo.equal |> List.filter RD.Tracked.varinfo_tracked in
let res = List.fold_left (assert_type_bounds ask) res vars in
if RD.is_bot_env res then raise Deadcode;
{st with rel = res}

Expand Down
23 changes: 23 additions & 0 deletions tests/regression/24-octagon/18-dead.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//SKIP PARAM: --enable ana.int.interval --set ana.activated[+] apron
// NOCRASH (was arithmetic on bottom)
int main(void)
{
int a;
unsigned short b;
int tmp;

b = (unsigned short )a;

if ((int )b + (int )b < (int )b) {

tmp = (int )b;
b += 1;

if (! tmp) {
tmp = 1;
}

}

return 0;
}
Loading