Skip to content
Open
Show file tree
Hide file tree
Changes from 75 commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
934cf98
Copied lineartwovarequalityanalysis and domain, including tests
leunam99 Jan 17, 2025
41135b8
added intervals, does not work yet
leunam99 Feb 3, 2025
231e164
Simple tests are working, no regression failures anymore
leunam99 Feb 5, 2025
5bdf17f
extended conditions + small cleanup
leunam99 Feb 10, 2025
f2e1fb6
Add config for gobcron testing
leunam99 Feb 12, 2025
003f332
second conf for testing
leunam99 Feb 14, 2025
8e5ff62
Take advantage of congruence information for refinement and asserts
leunam99 Feb 15, 2025
1d6ebc2
Fixes for meeting returning bot, Small cleanup
leunam99 Feb 17, 2025
a1b3eba
Fix refinement leading to bot, but not propagating
leunam99 Feb 17, 2025
e77e800
Fix evaluation using new context
leunam99 Feb 17, 2025
e30d79f
Modulo conditions supported
leunam99 Feb 18, 2025
e31836a
Fixed join not considering congruence constraints generated by rhs
leunam99 Feb 18, 2025
f215565
Fixed modular inverse for negative numbers, small adaptations
leunam99 Feb 19, 2025
5542e79
Indentation
leunam99 Feb 19, 2025
6da7797
Revert changes to affine_transform
leunam99 Feb 19, 2025
a84c202
More flexible invariant handling, refining all occuring vars
leunam99 Feb 22, 2025
7b7e55f
Better bounds checking for overflow, regression tests
leunam99 Feb 25, 2025
d5ec239
Splitting Subdomains into a separate file. Change function names ment…
leunam99 Feb 26, 2025
ce074de
Added Interface for Inequalities and integrated it into the lin2var_p…
leunam99 Feb 28, 2025
9e61cec
Simple Inequalities implemented, but not completely tested
leunam99 Mar 3, 2025
17047fa
transfering inequalities when assigning, bug fix in to_inequalities
leunam99 Mar 6, 2025
34331f1
Integrate Interval / Congruence with bounds into the original files
leunam99 Mar 6, 2025
c74832f
Use queries when assigning expressions
leunam99 Mar 6, 2025
2deec18
Fixed small bugs
leunam99 Mar 6, 2025
3fee377
Fixed more bugs
leunam99 Mar 6, 2025
280be0d
Fixed forget_variable not keeping invariant when root was deleted, ad…
leunam99 Mar 7, 2025
b602814
Make InEq stay sparse
leunam99 Mar 7, 2025
99ed24b
Fixed get_value not returning correct congruence information. Make al…
leunam99 Mar 7, 2025
cfad8f6
Revert changes to affine_transform, add comment why this is correct
leunam99 Mar 8, 2025
87bba0c
Make Termination Analysis use new domain instead of apron polyhedra (…
leunam99 Mar 11, 2025
8489b54
Fix TopIntOps returning usefull values for widening when bound is top
leunam99 Mar 11, 2025
2ccdc55
start of Complex linear inequalities, make join part of common action…
leunam99 Mar 20, 2025
937c0fc
fix accidentialy duplicated regression test
leunam99 Mar 20, 2025
6e8ee16
finish linear inequalities, generate inequalities with offset, allow …
leunam99 Mar 25, 2025
03b9f0a
small fixes, debugging output
leunam99 Mar 25, 2025
8788cdd
more fixing
leunam99 Mar 25, 2025
5b8fa24
make sure we only save relations for the roots, simple transfering
leunam99 Mar 26, 2025
582919b
remove value when the variable is replaced by a constant
leunam99 Mar 26, 2025
2222c20
fixed using wrong variable to calculate value refinements
leunam99 Mar 27, 2025
2ac6636
fixed looking at wrong bound in interval
leunam99 Mar 27, 2025
06bde16
larger rework of linear inequalities
leunam99 Apr 10, 2025
7ae6dda
first round of fixes
leunam99 Apr 10, 2025
f42c066
second round of fixes
leunam99 Apr 10, 2025
9b521db
make it non-strict equalities
leunam99 Apr 11, 2025
457ec76
missed value refinement
leunam99 Apr 11, 2025
e309216
more off-by-one errors
leunam99 Apr 11, 2025
7e29720
fix widening (and leq?)
leunam99 Apr 11, 2025
2d72269
leq fixed now?
leunam99 Apr 11, 2025
2cba0cf
another fix for leq where different kinds of bot did not return the c…
leunam99 Apr 11, 2025
0d22d78
join implement splitting
leunam99 Apr 26, 2025
2d4da5d
cache slopes
leunam99 Apr 26, 2025
cf60376
reworked limit to be lazy and need less memory
leunam99 Apr 29, 2025
549b38a
invariant implemented, TODO cleanup and sorting
leunam99 May 2, 2025
64f0810
fix substitution not handeling swapping sides
leunam99 May 2, 2025
c3a6db2
small fixes
leunam99 May 2, 2025
8c4de9f
renaming GT/LT to GE/LE to better reflect current purpose. Bugfixing …
leunam99 May 3, 2025
41f69c2
small fix: order correctly
leunam99 May 3, 2025
992c54c
refinement: general structure, allow for equality refinement, refine …
leunam99 May 3, 2025
069d3de
allow conversion to tcons for inverted conditions
leunam99 May 3, 2025
3ed88f2
refinement: refinement everywhere + some cleanup
leunam99 May 6, 2025
5d8207c
leq: do value refinement until fixpoint to properly represent relatio…
leunam99 May 7, 2025
b825fc0
in meet_relation, add some transitive inequalities. small fixes and c…
leunam99 May 12, 2025
40b19c0
small fixes
leunam99 May 12, 2025
9c534db
more fixes
leunam99 May 13, 2025
b2e7eaa
fixed join not being monotonic, also join inequalities where the othe…
leunam99 May 16, 2025
2dacbbe
accelerated narrowing, formatting
leunam99 May 19, 2025
22eb2b3
Allow division in linear relation if congruence proves exactness, sma…
leunam99 May 21, 2025
de4e5bb
do not lose value information when entering a function body
leunam99 May 23, 2025
17e223b
add missing
leunam99 Jun 14, 2025
3902ccc
Merge remote-tracking branch 'goblint/master'
leunam99 Jun 14, 2025
bc169d8
Rename file
leunam99 Jun 14, 2025
6890fa9
forgot adding dune file
leunam99 Jun 15, 2025
3019518
add weaker domains, proper options
leunam99 Jun 19, 2025
567301b
forgot staging formatting
leunam99 Jun 19, 2025
3c2b527
Merge branch 'goblint:master' into master
leunam99 Jun 23, 2025
287a6eb
keep map properly sparse, small fixes
leunam99 Jun 23, 2025
7ee3c88
use succ / pred
leunam99 Jun 23, 2025
1cc06dc
delete configuration for testing
leunam99 Jun 23, 2025
8ce2066
small fixes, remove asserts for performance
leunam99 Jun 24, 2025
d626bbd
fixed bug in join
leunam99 Jun 24, 2025
ec41fb5
revert last commit and include actual fix
leunam99 Jun 29, 2025
67f4207
Fix wrong results and other bugs, remove unused top function
leunam99 Jul 2, 2025
d00764a
fixes: do not report overflow in conversions to base, nontermination …
leunam99 Jul 5, 2025
7bc66ac
reenable interval narrowing after fixing underlying bug, disable asse…
leunam99 Jul 6, 2025
c093c14
fix regression test: wrong optimisation of join. Cleanup TODOs
leunam99 Jul 7, 2025
8426027
Merge branch 'master' into master
DrMichaelPetter Jul 16, 2025
d6f829f
move regression tests
leunam99 Jul 18, 2025
e9ef54f
Merge remote-tracking branch 'goblint/master'
leunam99 Jul 18, 2025
9ff7ece
Ignore division by zero in speculative execution
leunam99 Jul 22, 2025
de46b15
use Seq instead of Enum
leunam99 Jul 26, 2025
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
123 changes: 123 additions & 0 deletions conf/svcomp25_testing.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"ana": {
"sv-comp": {
"enabled": true,
"functions": true
},
"int": {
"def_exc": true,
"enums": false,
"interval": true
},
"float": {
"interval": true,
"evaluate_math_functions": true
},
"activated": [
"base",
"threadid",
"threadflag",
"threadreturn",
"mallocWrapper",
"mutexEvents",
"mutex",
"access",
"race",
"escape",
"expRelation",
"mhp",
"assert",
"var_eq",
"symb_locks",
"region",
"thread",
"threadJoins",
"abortUnless",
"lin2vareq_p"
],
"path_sens": [
"mutex",
"malloc_null",
"uninit",
"expsplit",
"activeSetjmp",
"memLeak",
"threadflag"
],
"context": {
"widen": false
},
"base": {
"arrays": {
"domain": "partitioned"
}
},
"race": {
"free": false,
"call": false
},
"lin2vareq_p": {
"inequalities" : "coeffs_threshold"
},
"autotune": {
"enabled": false,
"activated": [
"singleThreaded",
"mallocWrappers",
"noRecursiveIntervals",
"enums",
"congruence",
"octagon",
"wideningThresholds",
"loopUnrollHeuristic",
"memsafetySpecification",
"noOverflows",
"termination",
"tmpSpecialAnalysis"
],
"extraTerminationDomain": "lin2vareq_p"
}
},
"exp": {
"region-offsets": true
},
"solver": "td3",
"sem": {
"unknown_function": {
"spawn": false
},
"int": {
"signed_overflow": "assume_none"
},
"null-pointer": {
"dereference": "assume_none"
}
},
"witness": {
"graphml": {
"enabled": true,
"id": "enumerate",
"unknown": false
},
"yaml": {
"enabled": true,
"format-version": "2.0",
"entry-types": [
"invariant_set"
],
"invariant-types": [
"loop_invariant"
]
},
"invariant": {
"loop-head": true,
"after-lock": false,
"other": false,
"accessed": false,
"exact": true
}
},
"pre": {
"enabled": false
}
}
119 changes: 119 additions & 0 deletions conf/svcomp25_testing2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{
"ana": {
"sv-comp": {
"enabled": true,
"functions": true
},
"int": {
"def_exc": true,
"enums": false,
"interval": true
},
"float": {
"interval": true,
"evaluate_math_functions": true
},
"activated": [
"base",
"threadid",
"threadflag",
"threadreturn",
"mallocWrapper",
"mutexEvents",
"mutex",
"access",
"race",
"escape",
"expRelation",
"mhp",
"assert",
"var_eq",
"symb_locks",
"region",
"thread",
"threadJoins",
"abortUnless",
"lin2vareq"
],
"path_sens": [
"mutex",
"malloc_null",
"uninit",
"expsplit",
"activeSetjmp",
"memLeak",
"threadflag"
],
"context": {
"widen": false
},
"base": {
"arrays": {
"domain": "partitioned"
}
},
"race": {
"free": false,
"call": false
},
"autotune": {
"enabled": false,
"activated": [
"singleThreaded",
"mallocWrappers",
"noRecursiveIntervals",
"enums",
"congruence",
"octagon",
"wideningThresholds",
"loopUnrollHeuristic",
"memsafetySpecification",
"noOverflows",
"termination",
"tmpSpecialAnalysis"
]
}
},
"exp": {
"region-offsets": true
},
"solver": "td3",
"sem": {
"unknown_function": {
"spawn": false
},
"int": {
"signed_overflow": "assume_none"
},
"null-pointer": {
"dereference": "assume_none"
}
},
"witness": {
"graphml": {
"enabled": true,
"id": "enumerate",
"unknown": false
},
"yaml": {
"enabled": true,
"format-version": "2.0",
"entry-types": [
"invariant_set"
],
"invariant-types": [
"loop_invariant"
]
},
"invariant": {
"loop-head": true,
"after-lock": false,
"other": false,
"accessed": false,
"exact": true
}
},
"pre": {
"enabled": false
}
}
40 changes: 40 additions & 0 deletions src/analyses/apron/linearTwoVarEqualityAnalysisPentagon.apron.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
(** {{!RelationAnalysis} Relational integer value analysis} using an OCaml implementation of the linear two-variable equalities domain ([lin2vareq]).

@see <http://doi.acm.org/10.1145/2049706.2049710> A. Flexeder, M. Petter, and H. Seidl Fast Interprocedural Linear Two-Variable Equalities. *)

open Analyses
include RelationAnalysis

module NoIneq = LinearTwoVarEqualityDomainPentagon.D2(RepresentantDomains.NoInequalties)
module PentagonIneq = LinearTwoVarEqualityDomainPentagon.D2(RepresentantDomains.InequalityFunctor(RepresentantDomains.PentagonCoeffs))
module PentagonOffsetIneq = LinearTwoVarEqualityDomainPentagon.D2(RepresentantDomains.InequalityFunctor(RepresentantDomains.PentagonOffsetCoeffs))
module FullIneq = LinearTwoVarEqualityDomainPentagon.D2(RepresentantDomains.InequalityFunctor(RepresentantDomains.TwoVarInequalitySet))

let spec_module: (module MCPSpec) Lazy.t =
lazy (
let (module AD) = match GobConfig.get_string "ana.lin2vareq_p.inequalities" with
| "none" -> (module NoIneq : RelationDomain.RD)
| "pentagon" -> (module PentagonIneq : RelationDomain.RD)
| "pentagon_offset" -> (module PentagonOffsetIneq : RelationDomain.RD)
| _ -> (module FullIneq : RelationDomain.RD) (*Other options differ only in the limit function*)
in
let module Priv = (val RelationPriv.get_priv ()) in
let module Spec =
struct
include SpecFunctor (Priv) (AD) (RelationPrecCompareUtil.DummyUtil)
let name () = "lin2vareq_p"
end
in
(module Spec)
)

let get_spec (): (module MCPSpec) =
Lazy.force spec_module

let after_config () =
let module Spec = (val get_spec ()) in
MCP.register_analysis (module Spec : MCPSpec);
GobConfig.set_string "ana.path_sens[+]" (Spec.name ())

let _ =
AfterConfig.register after_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(* This analysis is empty on purpose. It serves only as an alternative dependency
in cases where the actual domain can't be used because of a missing library.
It was added because we don't want to fully depend on Apron. *)
6 changes: 3 additions & 3 deletions src/autoTune.ml
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,12 @@ let focusOnMemSafetySpecification () =
let focusOnTermination (spec: Svcomp.Specification.t) =
match spec with
| Termination ->
let terminationAnas = ["threadflag"; "apron"] in
let terminationAnas = ["threadflag"; get_string "ana.autotune.extraTerminationDomain"] in
enableAnalyses "Specification: Termination" "termination analyses" terminationAnas;
set_string "sem.int.signed_overflow" "assume_none";
set_bool "ana.int.interval" true;
set_string "ana.apron.domain" "polyhedra"; (* TODO: Needed? *)
()
if get_string "ana.autotune.extraTerminationDomain" = "apron" then
set_string "ana.apron.domain" "polyhedra"; (* TODO: Needed? *)
| _ -> ()

let focusOnTermination () =
Expand Down
71 changes: 54 additions & 17 deletions src/cdomain/value/cdomains/int/congruenceDomain.ml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
open IntDomain0
open GoblintCil

module type Norm = sig
val normalize : ikind -> (Z.t * Z.t) option -> (Z.t * Z.t) option
end

module Congruence : S with type int_t = Z.t and type t = (Z.t * Z.t) option =
module CongruenceFunctor (Norm : Norm): S with type int_t = Z.t and type t = (Z.t * Z.t) option =
struct
let name () = "congruences"
type int_t = Z.t
Expand All @@ -24,22 +27,7 @@ struct
let ( |: ) a b =
if a =: Z.zero then false else (b %: a) =: Z.zero

let normalize ik x =
match x with
| None -> None
| Some (c, m) ->
if m =: Z.zero then
if should_wrap ik then
Some (Size.cast ik c, m)
else
Some (c, m)
else
let m' = Z.abs m in
let c' = c %: m' in
if c' <: Z.zero then
Some (c' +: m', m')
else
Some (c' %: m', m')
let normalize = Norm.normalize

let range ik = Size.range ik

Expand Down Expand Up @@ -540,3 +528,52 @@ struct

let project ik p t = t
end

module Wrapping : Norm = struct

let (%:) = Z.rem
let (=:) = Z.equal
let (+:) = Z.add
let (<:) x y = Z.compare x y < 0

let normalize ik x =
match x with
| None -> None
| Some (c, m) ->
if m =: Z.zero then
if should_wrap ik then
Some (Size.cast ik c, m)
else
Some (c, m)
else
let m' = Z.abs m in
let c' = c %: m' in
if c' <: Z.zero then
Some (c' +: m', m')
else
Some (c' %: m', m')
end

module NoWrapping : Norm = struct

let (%:) = Z.rem
let (=:) = Z.equal
let (+:) = Z.add
let (<:) x y = Z.compare x y < 0

let normalize ik x =
match x with
| None -> None
| Some (c, m) ->
if m =: Z.zero then
Some (c, m)
else
let m' = Z.abs m in
let c' = c %: m' in
if c' <: Z.zero then
Some (c' +: m', m')
else
Some (c' %: m', m')
end

module Congruence = CongruenceFunctor(Wrapping)
Loading
Loading