├── .dockerignore ├── .gitignore ├── Dockerfile.alpine ├── Dockerfile.debian ├── LICENSE ├── META ├── Makefile ├── README.org ├── binsec ├── analyze.ml ├── arch_settings.mli ├── benchmark.ml ├── binsec_codex.ml ├── builtin_types.ml ├── builtin_types.mli ├── cfg_analysis.ml ├── cfg_analysis.mli ├── codex.ml ├── codex_logger.ml ├── codex_logger.mli ├── codex_main.ml ├── codex_options.ml ├── dba2Codex.ml ├── dba2Codex.mli ├── dhunk_analysis.ml ├── dhunk_analysis.mli ├── dune ├── heap_typing.ml ├── heap_typing.mli ├── hooks.ml ├── hooks.mli ├── html.ml ├── interval2symbol.ml ├── interval2symbol.mli ├── record_cfg.ml ├── record_cfg.mli ├── x86_arch.ml └── x86_arch.mli ├── binsec_codex.opam ├── codex.ml ├── codex.opam ├── codex_config.ml ├── codex_log.ml ├── constraints ├── constraints.ml ├── constraints_aliases.ml ├── constraints_condition.ml ├── constraints_const_eval.ml ├── constraints_const_eval.mli ├── constraints_constraints.ml ├── constraints_constraints.mli ├── constraints_constraints_sig.ml ├── constraints_slicing.ml ├── constraints_slicing.mli ├── constraints_smt.ml ├── constraints_smt.mli ├── dune ├── relations.ml ├── relations.mli └── relations_test.ml ├── dependency_graph.png ├── domains.ml ├── domains ├── assert_False_Transfer_Functions.ml ├── bitwise_domain.ml ├── bitwise_domain.mli ├── constraint_domain2.ml ├── constraint_domain2.mli ├── constraint_domains_sig.mli ├── constraints │ ├── domains_constraints_assert_false.ml │ ├── domains_constraints_assert_false.mli │ ├── domains_constraints_constraint_propagation.ml │ ├── domains_constraints_constraint_propagation.mli │ ├── domains_constraints_nonrelational.ml │ ├── domains_constraints_nonrelational.mli │ ├── domains_constraints_overflow_check.ml │ ├── domains_constraints_overflow_check.mli │ ├── domains_constraints_product.ml │ ├── domains_constraints_product.mli │ ├── domains_constraints_unionfind_builder.ml │ └── domains_constraints_unionfind_builder.mli ├── domain_sig.ml ├── dune ├── evaluating.mli ├── lift_integer_domain_to_binary_domain.ml ├── lift_integer_domain_to_binary_domain.mli ├── loop_domain.ml ├── memory │ ├── assert_False_Memory_Transfer_Functions.ml │ ├── fully_expanded_finite_region.ml │ ├── fully_expanded_finite_region.mli │ ├── memory_domain.ml │ ├── memory_domain.mli │ ├── memory_sig.ml │ ├── region_numeric_offset.ml │ ├── region_numeric_offset.mli │ ├── region_separation.ml │ ├── region_separation.mli │ ├── region_suffix_tree.ml │ ├── region_suffix_tree.mli │ ├── typed_address.ml │ ├── typed_address.mli │ ├── value_to_region.ml │ ├── value_to_region.mli │ ├── value_union_concatenation.ml │ ├── value_union_concatenation.mli │ ├── wholify.ml │ ├── wholify.mli │ ├── with_focusing.ml │ └── with_focusing.mli ├── prod_domain.ml └── with_Noop.ml ├── dune ├── dune-project ├── examples ├── Makefile ├── abs.c ├── abs.c.html ├── abs.cdump ├── abs.exe ├── abs.exe.html └── abs.types ├── ext ├── dune ├── frama_c_with_cudd │ ├── Makefile │ ├── internalize_machdeps.patch │ ├── opam-frama-c-27.1-Cobalt.patch │ ├── opam-frama-c-28.0-Nickel.patch │ ├── opam-frama-c-28.1-Nickel.patch │ └── patch-frama-c.patch └── framac_ival │ ├── .depend │ ├── abstract_interp.ml │ ├── abstract_interp.ml.orig │ ├── abstract_interp.mli │ ├── abstract_interp.mli.orig │ ├── bottom.ml │ ├── bottom.ml.orig │ ├── bottom.mli │ ├── bottom.mli.orig │ ├── c_bindings.c │ ├── dune │ ├── fc_float.ml │ ├── fc_float.mli │ ├── float_interval.ml │ ├── float_interval.mli │ ├── float_interval_sig.mli │ ├── float_sig.mli │ ├── floating_point.ml │ ├── floating_point.mli │ ├── fval.ml │ ├── fval.ml.orig │ ├── fval.mli │ ├── fval.mli.orig │ ├── integer.ml │ ├── integer.mli │ ├── ival.ml │ ├── ival.ml.orig │ ├── ival.mli │ ├── ival.mli.orig │ ├── ival_noinf.ml │ ├── ival_noinf.mli │ ├── pretty_utils.ml │ └── pretty_utils.mli ├── fixpoint ├── dune ├── fixpoint_graph.ml ├── fixpoint_graph.mli ├── fixpoint_wto.ml ├── fixpoint_wto.mli ├── reduce.ml ├── reduce.mli ├── regex.ml ├── regex.mli ├── region_analysis.ml ├── region_analysis.mli ├── region_analysis_sig.ml ├── wto.ml ├── wto.mli ├── wto_iteration.ml ├── wto_iteration.mli ├── wto_utils.ml └── wto_utils.mli ├── frama-c ├── C2Codex.ml ├── C2Codex.mli ├── Makefile ├── build_semantic_equations.ml ├── codexPlugin.ml ├── codex_options.ml ├── codex_register.ml ├── direct_analysis.ml ├── dune ├── exp_dump.ml ├── exp_dump.mli ├── frama_c_alarms.ml ├── frama_c_codex.ml ├── globals_needed.ml ├── globals_needed.mli ├── interpreted_automata_regexp.ml ├── interpreted_automata_regexp.mli ├── printhtml.ml ├── printhtml.mli ├── reduce.sh ├── region_analysis_stmt.ml ├── region_analysis_stmt.mli ├── test.types ├── test_types.ml ├── varinfo_Enclosing_Function.ml └── varinfo_Enclosing_Function.mli ├── frama_c_codex.opam ├── headers ├── CEA_LGPL21 └── headache_config.txt ├── lattices ├── assert_False_Lattice.ml ├── bitvector_standard.ml ├── dune ├── integer_standard.ml ├── lattice_sig.ml ├── lattices.ml ├── prod_Lattice.ml ├── prod_Lattice.mli ├── quadrivalent_Lattice.ml ├── quadrivalent_Lattice.mli ├── set_Lattice.ml ├── set_Lattice.mli ├── unit_Lattice.ml └── unit_Lattice.mli ├── libc.c ├── nix ├── binsec.nix ├── codex.nix ├── cudd.nix ├── default.nix ├── diff2junit.nix ├── frama-c.nix ├── grain_dypgen.nix ├── ocaml-lmdb.nix ├── pacomb.nix ├── patch-frama-c.patch ├── patricia-tree.nix ├── shell.nix └── z3.nix ├── single_value_abstraction ├── basis_Assert_False_Transfer_Functions.ml ├── basis_noop_transfer_functions.ml ├── basis_prod.ml ├── basis_prod.mli ├── basis_sig.ml ├── binary_collecting.ml ├── binary_collecting.mli ├── binary_test.ml ├── binary_to_integer_basis.ml ├── binary_to_integer_basis.mli ├── dummy_basis.ml ├── dune ├── ival_basis.ml ├── ival_basis.mli ├── ival_with_sentinel_basis.ml ├── ival_with_sentinel_basis.mli ├── known_bits_basis.ml ├── known_bits_basis.mli ├── quadrivalent_basis.ml ├── quadrivalent_basis.mli ├── reduced_prod_basis.ml ├── reduced_prod_basis.mli ├── sentinel_basis.ml ├── sentinel_basis.mli └── single_value_abstraction.ml ├── smtbackend ├── dune ├── smtbackend.ml ├── smtbackend_aliases.ml ├── smtbackend_smtlib.ml ├── smtbackend_smtlib.mli └── smtbackend_smtlib_sig.ml ├── test.sh ├── tests ├── tutorial │ ├── ex1-1.cdump │ ├── ex1-1.typ │ ├── ex1-2.cdump │ ├── ex1-2.typ │ ├── ex1-3.cdump │ ├── ex1-3.typ │ ├── ex1-4.cdump │ ├── ex1-4.typ │ ├── ex1-5.cdump │ ├── ex1-5.typ │ ├── ex1.c │ ├── ex1.cdump │ ├── ex1.typ │ ├── ex1_full.bdump │ ├── ex1_full.c │ └── ex1_full.exe ├── types │ ├── Makefile │ ├── aliasing.c │ ├── aliasing2.c │ ├── aliasing2_test2_aliasing2_types.cdump │ ├── aliasing2_test_aliasing2_types.cdump │ ├── aliasing2_types.c │ ├── aliasing_test_aliasing_types.cdump │ ├── aliasing_types.c │ ├── assert.c │ ├── assert2.c │ ├── assert2_assert_assign_assert2_types.cdump │ ├── assert2_assert_eq_assert2_types.cdump │ ├── assert2_assert_plus10_assert2_types.cdump │ ├── assert2_types.c │ ├── assert3.c │ ├── assert3_test1_assert3_types.cdump │ ├── assert3_test2_assert3_types.cdump │ ├── assert3_test3_assert3_types.cdump │ ├── assert3_types.c │ ├── assert4.c │ ├── assert4_test_diff_assert4_types.cdump │ ├── assert4_test_diff_assert4_types2.cdump │ ├── assert4_test_eq_assert4_types.cdump │ ├── assert4_test_eq_assert4_types2.cdump │ ├── assert4_types.c │ ├── assert4_types2.c │ ├── assert4_types3.c │ ├── assert4_types4.c │ ├── assert4_types5.c │ ├── assert4_types6.c │ ├── assert4_types7.c │ ├── assert_test_eq2_assert_types.cdump │ ├── assert_test_eq2_assert_types2.cdump │ ├── assert_test_eq_assert_types.cdump │ ├── assert_test_eq_assert_types2.cdump │ ├── assert_test_eq_to_4_assert_types.cdump │ ├── assert_test_eq_to_4_assert_types2.cdump │ ├── assert_test_load_eq_assert_types.cdump │ ├── assert_test_load_eq_assert_types2.cdump │ ├── assert_types.c │ ├── assert_types1.c │ ├── assert_types2.c │ ├── assert_types3.c │ ├── assert_types4.c │ ├── assert_types5.c │ ├── assert_types6.c │ ├── assert_types7.c │ ├── assume.c │ ├── assume_test_assume_types.cdump │ ├── assume_types.c │ ├── bad_load.c │ ├── bad_load_test1_bad_load_types.cdump │ ├── bad_load_test2_bad_load_types.cdump │ ├── bad_load_types.c │ ├── bad_loop.c │ ├── bad_loop_test_bad_loop_types.cdump │ ├── bad_loop_types.c │ ├── binsec-stubs.c │ ├── chandra_point.c │ ├── chandra_point_test1_chandra_point_types.cdump │ ├── chandra_point_test2_chandra_point_types.cdump │ ├── chandra_point_test3_chandra_point_types.cdump │ ├── chandra_point_types.c │ ├── chandra_radio.c │ ├── chandra_radio_test_chandra_radio_types.cdump │ ├── chandra_radio_types.c │ ├── comp.c │ ├── comp_types.c │ ├── comparison.c │ ├── comparison2.c │ ├── comparison2_test_comparison2_types.cdump │ ├── comparison2_types.c │ ├── comparison3.c │ ├── comparison3_test_comparison3_types.cdump │ ├── comparison3_types.c │ ├── comparison_test_ge_comparison_types.cdump │ ├── comparison_test_gt20_comparison_types.cdump │ ├── comparison_test_gt_comparison_types.cdump │ ├── comparison_test_le20_comparison_types.cdump │ ├── comparison_test_le_comparison_types.cdump │ ├── comparison_test_lt0_comparison_types.cdump │ ├── comparison_test_lt20_comparison_types.cdump │ ├── comparison_types.c │ ├── counter.c │ ├── counter_decr2_counter_types.cdump │ ├── counter_decr_counter_types.cdump │ ├── counter_incr2_counter_types.cdump │ ├── counter_incr_counter_types.cdump │ ├── counter_types.c │ ├── divide.c │ ├── divide_test_divide_types.cdump │ ├── divide_types.c │ ├── endian.c │ ├── endian_test1_endian_types.cdump │ ├── endian_test1_inverted_endian_types.cdump │ ├── endian_test2_endian_types.cdump │ ├── endian_test3_endian_types.cdump │ ├── endian_test4_endian_types.cdump │ ├── endian_test5_endian_types.cdump │ ├── endian_types.c │ ├── exists_fun.c │ ├── exists_fun_test_exists_fun_types.cdump │ ├── exists_fun_types.c │ ├── flexible.c │ ├── flexible_iter_flexible_types.cdump │ ├── flexible_read_flexible_types.cdump │ ├── flexible_read_wrong_flexible_types.cdump │ ├── flexible_types.c │ ├── flexible_write_flexible_types.cdump │ ├── fun_ptr.c │ ├── fun_ptr_test1_fun_ptr_types.cdump │ ├── fun_ptr_test2_fun_ptr_types.cdump │ ├── fun_ptr_test3_fun_ptr_types.cdump │ ├── fun_ptr_test4_fun_ptr_types.cdump │ ├── fun_ptr_test5_fun_ptr_types.cdump │ ├── fun_ptr_test6_fun_ptr_types.cdump │ ├── fun_ptr_test8_fun_ptr_types.cdump │ ├── fun_ptr_test9_fun_ptr_types.cdump │ ├── fun_ptr_types.c │ ├── global.c │ ├── global_test_global_types.cdump │ ├── global_types.c │ ├── infinite_loop.c │ ├── infinite_loop_main_infinite_loop_types.cdump │ ├── infinite_loop_types.c │ ├── list_same.c │ ├── list_same_list_iter_check_list_same_types.cdump │ ├── list_same_list_iter_list_same_types.cdump │ ├── list_same_types.c │ ├── load.c │ ├── load_test2_load_types.cdump │ ├── load_test_load_types.cdump │ ├── load_types.c │ ├── nested_loop.c │ ├── nested_loop_test_nested_loop_types.cdump │ ├── nested_loop_types.c │ ├── null_ptr.c │ ├── null_ptr_test_null_ptr_types.cdump │ ├── null_ptr_types.c │ ├── pair.c │ ├── pair2.c │ ├── pair2_test_const1_pair2_types.cdump │ ├── pair2_test_const2_pair2_types.cdump │ ├── pair2_test_exist1_pair2_types.cdump │ ├── pair2_test_exist2_pair2_types.cdump │ ├── pair2_test_exist3_pair2_types.cdump │ ├── pair2_types.c │ ├── pair2_types2.c │ ├── pair_test_pair_eq_pair_types.cdump │ ├── pair_test_pair_of_pair_eq2_pair_types.cdump │ ├── pair_test_pair_of_pair_eq3_pair_types.cdump │ ├── pair_test_pair_of_pair_eq_pair_types.cdump │ ├── pair_types.c │ ├── pair_write_1_x_4_pair_types.cdump │ ├── paireq2_types.c │ ├── param_types1.c │ ├── param_types2.c │ ├── param_types3.c │ ├── param_types4.c │ ├── param_types5.c │ ├── point.c │ ├── point_types.c │ ├── ptr_arith.c │ ├── ptr_arith_test_ptr_arith_types.cdump │ ├── ptr_arith_types.c │ ├── radio.c │ ├── radio_types.c │ ├── reduce1.c │ ├── reduce10.c │ ├── reduce10_types.c │ ├── reduce11.c │ ├── reduce11_types.c │ ├── reduce12.c │ ├── reduce12_test_reduce12_types.cdump │ ├── reduce12_types.c │ ├── reduce1_types.c │ ├── reduce2.c │ ├── reduce2_test_reduce2_types.cdump │ ├── reduce2_types.c │ ├── reduce3.c │ ├── reduce3_test_reduce3_types.cdump │ ├── reduce3_types.c │ ├── reduce4.c │ ├── reduce4_test_reduce4_types.cdump │ ├── reduce4_types.c │ ├── reduce5.c │ ├── reduce5_test_reduce5_types.cdump │ ├── reduce5_types.c │ ├── reduce6.c │ ├── reduce6_types.c │ ├── reduce7.c │ ├── reduce7_types.c │ ├── reduce8.c │ ├── reduce8_types.c │ ├── reduce9.c │ ├── reduce9_types.c │ ├── store.c │ ├── store_test_store_types.cdump │ ├── store_test_store_types2.cdump │ ├── store_test_store_types3.cdump │ ├── store_types.c │ ├── store_types1.c │ ├── store_types2.c │ ├── store_types3.c │ ├── string.c │ ├── string15_types.c │ ├── string20_types.c │ ├── string_fill_test_string_types.cdump │ ├── string_fill_test_string_types2.cdump │ ├── string_fill_test_string_types3.cdump │ ├── string_fill_test_wrong_string_types.cdump │ ├── string_fill_test_wrong_string_types2.cdump │ ├── string_fill_test_wrong_string_types3.cdump │ ├── string_test_access_string_types.cdump │ ├── string_test_access_string_types2.cdump │ ├── string_test_access_string_types3.cdump │ ├── string_types.c │ ├── string_types2.c │ ├── string_types3.c │ ├── string_zeros2_string_types.cdump │ ├── string_zeros2_string_types2.cdump │ ├── string_zeros2_string_types3.cdump │ ├── string_zeros3_string_types.cdump │ ├── string_zeros3_string_types2.cdump │ ├── string_zeros3_string_types3.cdump │ ├── string_zeros4_string_types.cdump │ ├── string_zeros4_string_types2.cdump │ ├── string_zeros4_string_types3.cdump │ ├── string_zeros5_string_types.cdump │ ├── string_zeros5_string_types2.cdump │ ├── string_zeros5_string_types3.cdump │ ├── string_zeros_string_types.cdump │ ├── string_zeros_string_types2.cdump │ ├── string_zeros_string_types3.cdump │ ├── test_cache.c │ ├── test_cache_alloc_list_test_cache_types.cdump │ ├── test_cache_alloc_pair_test_cache_types.cdump │ ├── test_cache_test_pair_test_cache_types.cdump │ ├── test_cache_types.c │ ├── test_comp.c │ ├── test_comp_types.c │ ├── test_loop_cond.c │ ├── test_loop_cond_types.c │ ├── variant.c │ ├── variant1.c │ ├── variant1V1_types.c │ ├── variant1V2_types.c │ ├── variant1V3_types.c │ ├── variant2.c │ ├── variant2_test_variant2_types.cdump │ ├── variant2_types.c │ ├── variant3.c │ ├── variant3_types.c │ ├── variant_ptr.c │ ├── variant_ptr_test_variant_ptr_types.cdump │ ├── variant_ptr_types.c │ ├── variant_test_variant_types.cdump │ ├── variant_test_variant_types3.cdump │ ├── variant_types.c │ ├── variant_types2.c │ ├── variant_types3.c │ ├── vector.c │ ├── vector47_types.c │ ├── vector_test_vector_types.cdump │ ├── vector_test_vector_types2.cdump │ ├── vector_types.c │ ├── vector_types2.c │ ├── wrong.c │ └── wrong_types.c └── unit │ ├── corrected │ ├── Makefile │ ├── bench.alarms.expected │ ├── binsec-stubs.c │ ├── binsec-stubs.h │ ├── rb_tree_after_cpp.c │ ├── rb_tree_after_cpp2.c │ ├── rb_tree_after_cpp3.c │ └── types.c │ └── invalid │ ├── Makefile │ ├── bad-load.c │ ├── bench.alarms │ ├── bench.alarms.expected │ ├── binsec-stubs.c │ ├── binsec-stubs.h │ └── types.c ├── transfer_functions ├── builtin.ml ├── dune ├── term.ml ├── term.mli ├── transfer_functions.ml ├── transfer_functions_concrete.ml ├── transfer_functions_conversions.ml ├── transfer_functions_conversions.mli ├── transfer_functions_flags.ml ├── transfer_functions_ids.ml └── transfer_functions_sig.ml ├── types ├── ctypes.ml ├── ctypes.mli ├── dune ├── parse_ctypes.ml ├── test.types ├── type_parse_tree.ml ├── type_parser.ml ├── type_parser.mli └── types.ml └── utils ├── bdd.ml ├── bdd.mli ├── cfg ├── cfg.ml ├── cfg.mli ├── cfg_sig.mli └── dune ├── condition_map.ml ├── condition_map.mli ├── cuddfix_c.c ├── datatype_sig.ml ├── datatype_sig.mli ├── dune ├── dynamic_array.ml ├── dynamic_array.mli ├── extstdlib.ml ├── extstdlib.mli ├── hetHashtbl.ml ├── hetHashtbl.mli ├── immutable_array.ml ├── immutable_array.mli ├── immutable_dynamic_array.ml ├── immutable_dynamic_array.mli ├── int_builtins.ml ├── int_builtins_c.c ├── int_builtins_ml.ml ├── int_builtins_tests.ml ├── interval_map.ml ├── interval_map.mli ├── mutable_radix_trie.ml ├── mutable_radix_trie.mli ├── not_implemented.ml ├── okasakimap.ml ├── okasakimap.mli ├── okasakiset.ml ├── okasakiset.mli ├── online_nearest_common_ancestor_skiplist.ml ├── online_nearest_common_ancestor_skiplist.mli ├── online_nearest_skew.ml ├── record_time.c ├── record_time.ml ├── skiplist.ml ├── skiplist.mli ├── smallmap.ml ├── smallmap.mli ├── tracelog ├── README.org ├── common.ml ├── dune ├── terminal.ml ├── terminal.mli ├── tracelog-mode.el ├── tracelog.ml ├── tracelog.mli └── tutorial.tlog ├── treemap.ml ├── treemap.mli ├── unionFind ├── dune ├── functional.ml ├── functional.mli ├── imperative.ml ├── imperative.mli ├── parameters.mli ├── signatures.mli └── union_find_test.ml └── utils.ml /.dockerignore: -------------------------------------------------------------------------------- 1 | _build 2 | ext/frama_c_with_cudd/frama-c* 3 | .dockerignore 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.cmti 2 | *.cmx 3 | *~ 4 | *.cmo 5 | *.cmi 6 | *.o 7 | *.cmt 8 | *.annot 9 | *.cma 10 | *.cmxa 11 | *.so 12 | *.a 13 | /a.out 14 | /unused 15 | /Codex.cmxs 16 | /Codex_DEP 17 | /doc/slides*.vrb 18 | /test/hostname* 19 | /doc/slides.pdf 20 | *_additional_notes.txt 21 | /test/unused 22 | /doc/*.org 23 | /test/*.c 24 | /deps.dot 25 | /depsred.dot 26 | /tests/*.diff 27 | /tests/*.sav 28 | unused/ 29 | /reduce.sh 30 | /test.c 31 | /.depend 32 | /maybe/ 33 | /frama-c/.Makefile.plugin.generated 34 | /frama-c/.depend 35 | /frama-c/CodexPlugin.check_mli_exists 36 | /frama-c/CodexPlugin.mli 37 | /frama-c/META.frama-c-codex 38 | /frama-c/META.frama-c-codexplugin 39 | frama-c/top/* 40 | /ext/framac_ival/dllc_bindings.so 41 | /_build/ 42 | /tests/vmcai2022/liSemanticDirected2017/*.alarms 43 | *-junit.xml 44 | /frama_c_codex.exe 45 | /binsec_codex.exe 46 | /ext/frama_c_with_cudd/frama-c-* 47 | -------------------------------------------------------------------------------- /META: -------------------------------------------------------------------------------- 1 | archive(byte) = "Codex.cma" 2 | archive(native) = "Codex.cmxa" 3 | plugin(byte) = "Codex.cma" 4 | plugin(native) = "Codex.cmxs" 5 | requires = "cudd zarith ocamlgraph" 6 | -------------------------------------------------------------------------------- /binsec/benchmark.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* This file is part of the Codex semantics library. *) 3 | (* *) 4 | (* Copyright (C) 2013-2024 *) 5 | (* CEA (Commissariat à l'énergie atomique et aux énergies *) 6 | (* alternatives) *) 7 | (* *) 8 | (* you can redistribute it and/or modify it under the terms of the GNU *) 9 | (* Lesser General Public License as published by the Free Software *) 10 | (* Foundation, version 2.1. *) 11 | (* *) 12 | (* It is distributed in the hope that it will be useful, *) 13 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 14 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 15 | (* GNU Lesser General Public License for more details. *) 16 | (* *) 17 | (* See the GNU Lesser General Public License version 2.1 *) 18 | (* for more details (enclosed in the file LICENSE). *) 19 | (* *) 20 | (**************************************************************************) 21 | 22 | let make x = 0 23 | 24 | let sub a b = 0 25 | 26 | let to_string x = "" 27 | -------------------------------------------------------------------------------- /binsec/x86_arch.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* This file is part of the Codex semantics library. *) 3 | (* *) 4 | (* Copyright (C) 2013-2024 *) 5 | (* CEA (Commissariat à l'énergie atomique et aux énergies *) 6 | (* alternatives) *) 7 | (* *) 8 | (* you can redistribute it and/or modify it under the terms of the GNU *) 9 | (* Lesser General Public License as published by the Free Software *) 10 | (* Foundation, version 2.1. *) 11 | (* *) 12 | (* It is distributed in the hope that it will be useful, *) 13 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 14 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 15 | (* GNU Lesser General Public License for more details. *) 16 | (* *) 17 | (* See the GNU Lesser General Public License version 2.1 *) 18 | (* for more details (enclosed in the file LICENSE). *) 19 | (* *) 20 | (**************************************************************************) 21 | 22 | module Make : Arch_settings.S 23 | -------------------------------------------------------------------------------- /binsec_codex.opam: -------------------------------------------------------------------------------- 1 | # This file is generated by dune, edit dune-project instead 2 | opam-version: "2.0" 3 | synopsis: "A BINSEC version built with the BINSEC/Codex plugin." 4 | maintainer: ["Matthieu Lemerre "] 5 | authors: [ 6 | "Matthieu Lemerre" 7 | "Julien Simonnet" 8 | "Olivier Nicole" 9 | "Dorian Lesbre" 10 | "Iker Canut" 11 | "Corentin Gendreau" 12 | "Guillaume Girol" 13 | ] 14 | license: "LGPL-2.1" 15 | bug-reports: "https://github.com/codex-semantics-library/codex/issues" 16 | depends: [ 17 | "dune" {>= "2.8"} 18 | "binsec" {>= "0.7"} 19 | "codex" {>= "1.0-rc1"} 20 | "odoc" {with-doc} 21 | ] 22 | build: [ 23 | ["dune" "subst"] {dev} 24 | [ 25 | "dune" 26 | "build" 27 | "-p" 28 | name 29 | "-j" 30 | jobs 31 | "@install" 32 | "@runtest" {with-test} 33 | "@doc" {with-doc} 34 | ] 35 | ] 36 | -------------------------------------------------------------------------------- /codex.opam: -------------------------------------------------------------------------------- 1 | # This file is generated by dune, edit dune-project instead 2 | opam-version: "2.0" 3 | version: "1.0-rc1" 4 | synopsis: "The Codex library for static analysis" 5 | maintainer: ["Matthieu Lemerre "] 6 | authors: [ 7 | "Matthieu Lemerre" 8 | "Julien Simonnet" 9 | "Olivier Nicole" 10 | "Dorian Lesbre" 11 | "Iker Canut" 12 | "Corentin Gendreau" 13 | "Guillaume Girol" 14 | ] 15 | license: "LGPL-2.1" 16 | bug-reports: "https://github.com/codex-semantics-library/codex/issues" 17 | depends: [ 18 | "dune" {>= "2.8"} 19 | "bheap" {>= "2.0.0"} 20 | "camlp-streams" {>= "5.0.1"} 21 | "mlcuddidl" {>= "3.0.8"} 22 | "qcheck-core" {>= "0.21.2"} 23 | "pacomb" {>= "1.3"} 24 | "ppx_inline_test" {>= "v0.16.0"} 25 | "zarith" {>= "1.13"} 26 | "patricia-tree" {>= "0.10.0"} 27 | "odoc" {with-doc} 28 | ] 29 | build: [ 30 | ["dune" "subst"] {dev} 31 | [ 32 | "dune" 33 | "build" 34 | "-p" 35 | name 36 | "-j" 37 | jobs 38 | "@install" 39 | "@runtest" {with-test} 40 | "@doc" {with-doc} 41 | ] 42 | ] 43 | -------------------------------------------------------------------------------- /dependency_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codex-semantics-library/codex/f44de9fce2692ab77a1583e0a485327ab956d861/dependency_graph.png -------------------------------------------------------------------------------- /examples/Makefile: -------------------------------------------------------------------------------- 1 | FRAMA_C_CODEX=frama_c_codex.exe 2 | # FRAMA_C = dune exec frama-c -- -machdep x86_32 -codex 3 | BINSEC_CODEX=binsec_codex.exe 4 | # BINSEC_CODEX=dune exec binsec_codex -- -codex 5 | 6 | 7 | abs.cdump abs.c.html: 8 | $(FRAMA_C_CODEX) abs.c -codex-exp-dump abs.cdump -codex-html-dump abs.c.html -main abs 9 | 10 | abs.exe: 11 | clang -m32 -O1 abs.c -o abs.exe 12 | 13 | abs.bdump abs.exe.html: 14 | $(BINSEC_CODEX) abs.exe -entrypoint abs -codex-type-file abs.types -codex-output-html abs.exe.html 15 | -------------------------------------------------------------------------------- /examples/abs.c: -------------------------------------------------------------------------------- 1 | int abs(int i){ 2 | int res; 3 | if(i < 0){ 4 | res = -i; 5 | } 6 | else { 7 | res = i; 8 | } 9 | res += 0 / res; 10 | return res; 11 | } 12 | 13 | int main(){ 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /examples/abs.cdump: -------------------------------------------------------------------------------- 1 | abs.c:3.5-10: `i < 0' -> {0; 1} 2 | abs.c:3.5-6: `i' -> [--..--] 3 | abs.c:4.10-12: `- i' -> [1..0x7FFFFFFF] 4 | abs.c:4.11-12: `i' -> [-0x80000000..-1] 5 | abs.c:7.10-11: `i' -> [0..0x7FFFFFFF] 6 | abs.c:9.2-16: `res + 0 / res' -> [1..0x7FFFFFFF] 7 | abs.c:9.2-5: `res' -> [0..0x7FFFFFFF] 8 | abs.c:9.9-16: `0 / res' -> {0} 9 | abs.c:9.13-16: `res' -> [0..0x7FFFFFFF] 10 | abs.c:10.9-12: `res' -> [1..0x7FFFFFFF] 11 | Unproved alarms: 12 | abs.c:9: Division_by_zero(res) {true;false} 13 | Proved 0/1 alarms 14 | Unproved 1 regular alarms and 0 additional alarms. 15 | Solved 0/0 user assertions, proved 0 16 | -------------------------------------------------------------------------------- /examples/abs.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codex-semantics-library/codex/f44de9fce2692ab77a1583e0a485327ab956d861/examples/abs.exe -------------------------------------------------------------------------------- /examples/abs.types: -------------------------------------------------------------------------------- 1 | /* -*- mode:c -*- */ 2 | int abs((int with self < 1000 && self + 2000 >= 0) a); 3 | -------------------------------------------------------------------------------- /ext/dune: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;; This file is part of the Codex semantics library. ;; 3 | ;; ;; 4 | ;; Copyright (C) 2013-2024 ;; 5 | ;; CEA (Commissariat à l'énergie atomique et aux énergies ;; 6 | ;; alternatives) ;; 7 | ;; ;; 8 | ;; you can redistribute it and/or modify it under the terms of the GNU ;; 9 | ;; Lesser General Public License as published by the Free Software ;; 10 | ;; Foundation, version 2.1. ;; 11 | ;; ;; 12 | ;; It is distributed in the hope that it will be useful, ;; 13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; 15 | ;; GNU Lesser General Public License for more details. ;; 16 | ;; ;; 17 | ;; See the GNU Lesser General Public License version 2.1 ;; 18 | ;; for more details (enclosed in the file LICENSE). ;; 19 | ;; ;; 20 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 21 | 22 | (dirs framac_ival) 23 | -------------------------------------------------------------------------------- /ext/frama_c_with_cudd/opam-frama-c-27.1-Cobalt.patch: -------------------------------------------------------------------------------- 1 | --- a/opam 2024-01-12 02:21:09.771672337 +0100 2 | +++ b/opam 2024-01-12 02:29:11.010315374 +0100 3 | @@ -120,15 +120,11 @@ 4 | "dune-configurator" 5 | "dune-site" 6 | 7 | - ( "alt-ergo-free" | "alt-ergo" ) 8 | - "conf-graphviz" { post } 9 | "conf-time" { with-test } 10 | "menhir" { >= "20181006" & build } 11 | "ocaml" { >= "4.11.1" } 12 | "ocamlfind" # needed beyond build stage, used by -load-module 13 | "ocamlgraph" { >= "1.8.8" } 14 | - "odoc" { with-doc } 15 | - "why3" { >= "1.6.0" } 16 | "yaml" { >= "3.0.0" } 17 | "yojson" {>= "1.6.0" & (>= "2.0.1" | !with-test)} 18 | "zarith" { >= "1.5" } 19 | @@ -138,11 +134,6 @@ 20 | "ppx_deriving_yojson" 21 | "ppx_deriving_yaml" { >= "0.2.0" } 22 | "ppx_import" 23 | - 24 | - # GTK3 for non-macos only 25 | - "lablgtk3" { >= "3.1.0" & os!="macos" } 26 | - "lablgtk3-sourceview3" { os!="macos" } 27 | - "conf-gtksourceview3" { os!="macos" } 28 | ] 29 | 30 | # Note: do not put particular versions here, if some version is *incompatible*, 31 | -------------------------------------------------------------------------------- /ext/frama_c_with_cudd/opam-frama-c-28.0-Nickel.patch: -------------------------------------------------------------------------------- 1 | --- a/opam 2023-11-30 01:00:00.000000000 +0100 2 | +++ b/opam 2024-01-12 13:03:11.817050752 +0100 3 | @@ -123,16 +123,12 @@ 4 | "dune-configurator" 5 | "dune-site" { >= "3.7.0" } 6 | 7 | - ( "alt-ergo-free" | "alt-ergo" ) 8 | - "conf-graphviz" { post } 9 | "conf-time" { with-test } 10 | "menhir" { >= "20181006" & build } 11 | "ocaml" { >= "4.13.1" } 12 | "ocamlgraph" { >= "1.8.8" } 13 | "ocamlgraph" { with-test & >= "2.1.0" } 14 | - "odoc" { with-doc } 15 | "unionFind" { >= "20220107" } 16 | - "why3" { >= "1.6.0" & ( < "1.7.0" | !with-test ) } 17 | "yaml" { >= "3.0.0" } 18 | "yojson" {>= "1.6.0" & (>= "2.0.1" | !with-test)} 19 | "zarith" { >= "1.5" } 20 | @@ -143,11 +139,6 @@ 21 | "ppx_deriving_yaml" { >= "0.2.0" } 22 | "ppx_import" 23 | 24 | - # GTK3 disabled on macOS (segfaults), and made optional on Windows 25 | - # (due to complex situation with Cygwin + MinGW). 26 | - "lablgtk3" { >= "3.1.0" & os!="macos" & os-family!="windows" } 27 | - "lablgtk3-sourceview3" { os!="macos" & os-family!="windows" } 28 | - "conf-gtksourceview3" { os!="macos" & os-family!="windows" } 29 | ] 30 | 31 | # Note: do not put particular versions here, if some version is *incompatible*, 32 | -------------------------------------------------------------------------------- /ext/frama_c_with_cudd/opam-frama-c-28.1-Nickel.patch: -------------------------------------------------------------------------------- 1 | --- a/opam 2023-11-30 01:00:00.000000000 +0100 2 | +++ b/opam 2024-01-12 13:03:11.817050752 +0100 3 | @@ -123,16 +123,12 @@ 4 | "dune-configurator" 5 | "dune-site" { >= "3.7.0" } 6 | 7 | - ( "alt-ergo-free" | "alt-ergo" ) 8 | - "conf-graphviz" { post } 9 | "conf-time" { with-test } 10 | "menhir" { >= "20181006" & build } 11 | "ocaml" { >= "4.13.1" } 12 | "ocamlgraph" { >= "1.8.8" } 13 | "ocamlgraph" { with-test & >= "2.1.0" } 14 | - "odoc" { with-doc } 15 | "unionFind" { >= "20220107" } 16 | - "why3" { >= "1.6.0" & ( < "1.7.0" | !with-test ) } 17 | "yaml" { >= "3.0.0" } 18 | "yojson" {>= "1.6.0" & (>= "2.0.1" | !with-test)} 19 | "zarith" { >= "1.5" } 20 | @@ -143,11 +139,6 @@ 21 | "ppx_deriving_yaml" { >= "0.2.0" } 22 | "ppx_import" 23 | 24 | - # GTK3 disabled on macOS (segfaults), and made optional on Windows 25 | - # (due to complex situation with Cygwin + MinGW). 26 | - "lablgtk3" { >= "3.1.0" & os!="macos" & os-family!="windows" } 27 | - "lablgtk3-sourceview3" { os!="macos" & os-family!="windows" } 28 | - "conf-gtksourceview3" { os!="macos" & os-family!="windows" } 29 | ] 30 | 31 | # Note: do not put particular versions here, if some version is *incompatible*, 32 | -------------------------------------------------------------------------------- /frama-c/codexPlugin.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* This file is part of the Codex semantics library. *) 3 | (* *) 4 | (* Copyright (C) 2013-2024 *) 5 | (* CEA (Commissariat à l'énergie atomique et aux énergies *) 6 | (* alternatives) *) 7 | (* *) 8 | (* you can redistribute it and/or modify it under the terms of the GNU *) 9 | (* Lesser General Public License as published by the Free Software *) 10 | (* Foundation, version 2.1. *) 11 | (* *) 12 | (* It is distributed in the hope that it will be useful, *) 13 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 14 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 15 | (* GNU Lesser General Public License for more details. *) 16 | (* *) 17 | (* See the GNU Lesser General Public License version 2.1 *) 18 | (* for more details (enclosed in the file LICENSE). *) 19 | (* *) 20 | (**************************************************************************) 21 | 22 | -------------------------------------------------------------------------------- /frama-c/test.types: -------------------------------------------------------------------------------- 1 | /* -*- mode:c -*- */ 2 | struct foo { 3 | (int with self = 3) i; 4 | (int with self >= 5) j; 5 | }; 6 | 7 | def a = struct foo /* With a comment. */ 8 | 9 | int main(struct foo? p); 10 | 11 | -------------------------------------------------------------------------------- /frama_c_codex.opam: -------------------------------------------------------------------------------- 1 | # This file is generated by dune, edit dune-project instead 2 | opam-version: "2.0" 3 | synopsis: """ 4 | The Frama-C/Codex plugin for modular static analysis of C. 5 | The package contains both a standalone frama_c_codex executable, as well 6 | as a plugin which works on patched versions of Frama_C.""" 7 | maintainer: ["Matthieu Lemerre "] 8 | authors: [ 9 | "Matthieu Lemerre" 10 | "Julien Simonnet" 11 | "Olivier Nicole" 12 | "Dorian Lesbre" 13 | "Iker Canut" 14 | "Corentin Gendreau" 15 | "Guillaume Girol" 16 | ] 17 | license: "LGPL-2.1" 18 | bug-reports: "https://github.com/codex-semantics-library/codex/issues" 19 | depends: [ 20 | "dune" {>= "2.8"} 21 | "frama-c" {>= "26.0" & < "28.0"} 22 | "codex" {>= "1.0-rc1"} 23 | "odoc" {with-doc} 24 | ] 25 | build: [ 26 | ["dune" "subst"] {dev} 27 | [ 28 | "dune" 29 | "build" 30 | "-p" 31 | name 32 | "-j" 33 | jobs 34 | "@install" 35 | "@runtest" {with-test} 36 | "@doc" {with-doc} 37 | ] 38 | ] 39 | -------------------------------------------------------------------------------- /headers/CEA_LGPL21: -------------------------------------------------------------------------------- 1 | This file is part of the Codex semantics library. 2 | 3 | Copyright (C) 2013-2024 4 | CEA (Commissariat à l'énergie atomique et aux énergies 5 | alternatives) 6 | 7 | you can redistribute it and/or modify it under the terms of the GNU 8 | Lesser General Public License as published by the Free Software 9 | Foundation, version 2.1. 10 | 11 | It is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | See the GNU Lesser General Public License version 2.1 17 | for more details (enclosed in the file LICENSE). 18 | 19 | -------------------------------------------------------------------------------- /lattices/unit_Lattice.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* This file is part of the Codex semantics library. *) 3 | (* *) 4 | (* Copyright (C) 2013-2024 *) 5 | (* CEA (Commissariat à l'énergie atomique et aux énergies *) 6 | (* alternatives) *) 7 | (* *) 8 | (* you can redistribute it and/or modify it under the terms of the GNU *) 9 | (* Lesser General Public License as published by the Free Software *) 10 | (* Foundation, version 2.1. *) 11 | (* *) 12 | (* It is distributed in the hope that it will be useful, *) 13 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 14 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 15 | (* GNU Lesser General Public License for more details. *) 16 | (* *) 17 | (* See the GNU Lesser General Public License version 2.1 *) 18 | (* for more details (enclosed in the file LICENSE). *) 19 | (* *) 20 | (**************************************************************************) 21 | 22 | include Lattice_sig.Complete_Lattice with type t = unit 23 | val singleton: 'a -> unit 24 | -------------------------------------------------------------------------------- /nix/binsec.nix: -------------------------------------------------------------------------------- 1 | { lib 2 | , nix-gitignore 3 | , gmp 4 | , mmap 5 | , ocamlgraph 6 | , zarith 7 | , menhir 8 | , toml 9 | /* , llvm */ 10 | , dune-site 11 | , qtest 12 | , ounit 13 | , qcheck 14 | , seq 15 | /* , unisim_archisec */ 16 | , buildDunePackage 17 | , bubblewrap 18 | , glibc 19 | , curses 20 | , pkgsi686Linux 21 | , python3 22 | , bitwuzla 23 | , boolector 24 | , z3 25 | , gdb 26 | , file 27 | , grain_dypgen 28 | }: 29 | buildDunePackage { 30 | pname = "binsec"; 31 | version = "dev"; 32 | 33 | duneVersion = "3"; 34 | 35 | 36 | src = fetchGit { 37 | url = "https://gitlab-ci-token:${builtins.getEnv "CI_JOB_TOKEN"}@git.frama-c.com/binary/binsec"; 38 | /* version 0.8.1. */ 39 | rev = "8fb27e39e3a025b15407a1fd73d56655227d5ed1"; 40 | }; 41 | 42 | nativeBuildInputs = [ 43 | dune-site 44 | menhir 45 | grain_dypgen 46 | ]; 47 | 48 | buildInputs = [ 49 | gmp # for zarith 50 | ocamlgraph 51 | zarith 52 | dune-site 53 | /* llvm */ 54 | menhir 55 | grain_dypgen 56 | toml 57 | /* unisim_archisec */ 58 | curses 59 | mmap 60 | ]; 61 | 62 | checkInputs = [ 63 | qtest 64 | ounit 65 | qcheck 66 | seq 67 | bubblewrap 68 | python3 69 | z3 70 | bitwuzla 71 | boolector 72 | gdb 73 | file 74 | ]; 75 | 76 | doCheck = true; 77 | } 78 | -------------------------------------------------------------------------------- /nix/codex.nix: -------------------------------------------------------------------------------- 1 | { ocaml, bheap, ocamlgraph, camlp-streams, nix-gitignore, stdenv, gmp, findlib, binsec, framac, zarith, cudd, yaml, menhirLib 2 | , yojson, apron, menhir, ppx_import, ppx_deriving, ppx_deriving_yojson, 3 | dune_3, dune-configurator, dune-site, zmq, sexplib, ppx_sexp_conv, ppx_inline_test, qcheck, diff2junit }: 4 | let 5 | pkgs = import {}; 6 | ocaml-lmdb = pkgs.ocaml-ng.ocamlPackages_4_14.callPackage ./ocaml-lmdb.nix {}; 7 | pacomb = pkgs.ocaml-ng.ocamlPackages_4_14.callPackage ./pacomb.nix {}; 8 | patricia-tree = pkgs.ocaml-ng.ocamlPackages_4_14.callPackage ./patricia-tree.nix {}; 9 | # lmdb-ocaml = with pkgs; with stdenv; import ./lmdb-ocaml.nix { inherit stdenv ocaml lib buildDunePackage lmdb fetchzip; }; 10 | in 11 | stdenv.mkDerivation { 12 | pname = "codex"; 13 | version = "1.0.0"; 14 | src = nix-gitignore.gitignoreSourcePure 15 | [ 16 | ../.gitignore 17 | "../nix" 18 | ] ../.; 19 | buildInputs = [ 20 | gmp # for zarith 21 | ocaml 22 | findlib 23 | ocamlgraph 24 | zarith 25 | bheap 26 | cudd 27 | pacomb 28 | patricia-tree 29 | camlp-streams 30 | yaml 31 | framac 32 | binsec 33 | yojson 34 | apron 35 | menhir 36 | menhirLib 37 | ppx_import 38 | ppx_deriving 39 | ppx_deriving_yojson 40 | ppx_inline_test 41 | dune_3 42 | dune-configurator 43 | dune-site 44 | diff2junit 45 | qcheck 46 | zmq 47 | # For odvtk 48 | ocaml-lmdb 49 | sexplib 50 | ppx_sexp_conv 51 | ]; 52 | } 53 | -------------------------------------------------------------------------------- /nix/cudd.nix: -------------------------------------------------------------------------------- 1 | { stdenv, lib, fetchzip, ocaml, findlib, camlidl, m4 }: 2 | 3 | stdenv.mkDerivation rec { 4 | pname = "ocaml${ocaml.version}-mlcuddidl"; 5 | version = "3.0.8"; 6 | src = fetchzip { 7 | # url = "http://nberth.space/pool/mlcuddidl/mlcuddidl-${version}.tar.gz"; 8 | url = "https://framagit.org/nberth/mlcuddidl/-/archive/3.0.8/mlcuddidl-3.0.8.tar.gz"; 9 | # sha256 = "09hbgw18c6mfx4zy3rydkfqnj2v55rccz3i6anccn82fq1nsx5lz"; 10 | # sha512 = "b039fd1162bef7460bc7cf378a000d35730d5327ec4648dfe7eef88c148fb6812764bf32a1801353a09f59c9bcd6ea386f77e1896e48b53163d4c081fed5a80c"; 11 | # sha256 = "dcdad49917ef1b01c109fe4fb947d7cc48c8c63c930f6092a86ecc0857cff8cd"; 12 | hash="sha256-2tyZ1O8XARsJwU/+R7nM18hIPMYPk5JgbqgIzM9Xzfg="; 13 | }; 14 | 15 | nativeBuildInputs = [ ocaml findlib m4 ]; 16 | buildInputs = [ camlidl ]; 17 | 18 | createFindlibDestdir = true; 19 | 20 | meta = { 21 | description = "OCaml interface to the CUDD BDD library"; 22 | homepage = https://www.inrialpes.fr/pop-art/people/bjeannet/mlxxxidl-forge/mlcuddidl/; 23 | license = lib.licenses.lgpl21; 24 | inherit (ocaml.meta) platforms; 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /nix/default.nix: -------------------------------------------------------------------------------- 1 | let 2 | pkgs = import {}; 3 | cp = pkgs.ocaml-ng.ocamlPackages_4_14.callPackage; 4 | cudd = cp ./cudd.nix {}; 5 | grain_dypgen = cp ./grain_dypgen.nix {}; 6 | diff2junit = cp ./diff2junit.nix {}; 7 | binsec = cp ./binsec.nix { inherit grain_dypgen; }; 8 | framac = cp ./frama-c.nix { inherit cudd; }; 9 | codex = cp ./codex.nix { inherit cudd binsec framac diff2junit; }; 10 | in 11 | codex 12 | -------------------------------------------------------------------------------- /nix/diff2junit.nix: -------------------------------------------------------------------------------- 1 | { buildDunePackage }: 2 | buildDunePackage { 3 | pname = "diff2junit"; 4 | version = "dev"; 5 | duneVersion = "3"; 6 | src = fetchGit { 7 | url = "https://gitlab-ci-token:${builtins.getEnv "CI_JOB_TOKEN"}@git.frama-c.com/codex/diff2junit"; 8 | rev = "ac3d90b47e8f00b9736d82d590fce956275adfb0"; 9 | }; 10 | 11 | nativeBuildInputs = []; 12 | buildInputs = []; 13 | checkInputs = []; 14 | doCheck = true; 15 | } -------------------------------------------------------------------------------- /nix/grain_dypgen.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ocaml, findlib }: 2 | pkgs.stdenv.mkDerivation rec { 3 | pname = "grain_dypgen"; 4 | version = "0.2"; 5 | 6 | src = pkgs.fetchurl { 7 | url = "https://github.com/grain-lang/dypgen/archive/0.2.tar.gz"; 8 | sha512 = "b01044243d76550194ea1a9e93eb53f525ae9e88ef0a1d69c5c00ef7adf3791d88df72f8ccb47fe0966c54fc214ff8e54f3cdf34c7627ea10b3a1a64f2e683a0"; 9 | }; 10 | 11 | buildInputs = [ ocaml findlib ]; 12 | 13 | installPhase = '' 14 | make install DYPGENLIBDIR=$out/lib/ocaml/${ocaml.version}/site-lib/ BINDIR=$out/bin/ MANDIR=$out/man/man1 15 | ''; 16 | } 17 | -------------------------------------------------------------------------------- /nix/ocaml-lmdb.nix: -------------------------------------------------------------------------------- 1 | { stdenv, ocaml, lib, buildDunePackage, lmdb, fetchzip, dune-configurator, bigstringaf, pkg-config }: 2 | 3 | buildDunePackage rec { 4 | pname = "lmdb"; 5 | version = "1.0"; 6 | src = fetchzip { 7 | url = "https://github.com/Drup/ocaml-lmdb/archive/1.0.tar.gz"; 8 | sha256 = "1h461i4n9mpdzpsplzmfjnr2vqjm2yk028h3m1rjifk92gpqrf1m"; 9 | }; 10 | 11 | useDune2 = true; 12 | nativeBuildInputs = [ pkg-config ]; 13 | propagatedBuildInputs = [ lmdb dune-configurator bigstringaf ]; 14 | strictDeps = true; 15 | createFindlibDestdir = true; 16 | 17 | meta = { 18 | description = "OCaml interface to the LMDB library"; 19 | homepage = https://github.com/Drup/ocaml-lmdb/; 20 | license = lib.licenses.mit; 21 | inherit (ocaml.meta) platforms; 22 | }; 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /nix/pacomb.nix: -------------------------------------------------------------------------------- 1 | { stdenv, ocaml, lib, buildDunePackage, findlib, fetchzip, stdlib-shims, ppxlib }: 2 | 3 | buildDunePackage rec { 4 | pname = "pacomb"; 5 | version = "1.3"; 6 | src = fetchzip { 7 | url = "https://github.com/craff/pacomb/archive/refs/tags/1.3.tar.gz"; 8 | hash = "sha256-7y5/57FVLBLPH951LBESEXW/WnvgsZiWc6XG954jTGc="; 9 | }; 10 | 11 | duneVersion = "3"; 12 | doCheck = true; 13 | checkInputs = [ stdlib-shims ]; 14 | buildInputs = [ ppxlib stdlib-shims ]; 15 | 16 | meta = { 17 | description = "OCaml parser combinator library"; 18 | homepage = https://github.com/craff/pacomb/; 19 | license = lib.licenses.mit; 20 | inherit (ocaml.meta) platforms; 21 | }; 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /nix/patricia-tree.nix: -------------------------------------------------------------------------------- 1 | { stdenv, ocaml, lib, buildDunePackage, findlib, fetchzip, fetchgit, zarith, qcheck, ppx_inline_test, mdx }: 2 | 3 | buildDunePackage rec { 4 | pname = "patricia-tree"; 5 | version = "0.10"; 6 | 7 | src = fetchGit { 8 | url = "https://github.com/codex-semantics-library/patricia-tree.git"; 9 | rev = "${builtins.getEnv "PATRICIA_TREE_REV"}"; 10 | # "ab57e7e6c722c34219a8e97390b51bea85653d0f"; 11 | }; 12 | 13 | duneVersion = "3"; 14 | doCheck = false; 15 | checkInputs = []; 16 | buildInputs = [ zarith qcheck ppx_inline_test mdx ]; 17 | } 18 | -------------------------------------------------------------------------------- /nix/shell.nix: -------------------------------------------------------------------------------- 1 | let 2 | pkgs = import {}; 3 | codex = import ./default.nix; 4 | z3 = pkgs.callPackage ./z3.nix {}; 5 | in 6 | pkgs.mkShell { 7 | inputsFrom = [ codex ]; 8 | nativeBuildInputs = [ pkgs.ocaml-ng.ocamlPackages_4_14.merlin pkgs.dune_3 z3 ]; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /single_value_abstraction/ival_with_sentinel_basis.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* This file is part of the Codex semantics library. *) 3 | (* *) 4 | (* Copyright (C) 2013-2024 *) 5 | (* CEA (Commissariat à l'énergie atomique et aux énergies *) 6 | (* alternatives) *) 7 | (* *) 8 | (* you can redistribute it and/or modify it under the terms of the GNU *) 9 | (* Lesser General Public License as published by the Free Software *) 10 | (* Foundation, version 2.1. *) 11 | (* *) 12 | (* It is distributed in the hope that it will be useful, *) 13 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 14 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 15 | (* GNU Lesser General Public License for more details. *) 16 | (* *) 17 | (* See the GNU Lesser General Public License version 2.1 *) 18 | (* for more details (enclosed in the file LICENSE). *) 19 | (* *) 20 | (**************************************************************************) 21 | 22 | include Basis_sig.Numeric_Basis 23 | -------------------------------------------------------------------------------- /single_value_abstraction/known_bits_basis.mli: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* This file is part of the Codex semantics library. *) 3 | (* *) 4 | (* Copyright (C) 2013-2024 *) 5 | (* CEA (Commissariat à l'énergie atomique et aux énergies *) 6 | (* alternatives) *) 7 | (* *) 8 | (* you can redistribute it and/or modify it under the terms of the GNU *) 9 | (* Lesser General Public License as published by the Free Software *) 10 | (* Foundation, version 2.1. *) 11 | (* *) 12 | (* It is distributed in the hope that it will be useful, *) 13 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 14 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 15 | (* GNU Lesser General Public License for more details. *) 16 | (* *) 17 | (* See the GNU Lesser General Public License version 2.1 *) 18 | (* for more details (enclosed in the file LICENSE). *) 19 | (* *) 20 | (**************************************************************************) 21 | 22 | -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -eu 2 | 3 | DIR=$(dirname $0) 4 | 5 | echo "Dir is |$DIR| token is |$TOKEN_FOR_API|" 6 | -------------------------------------------------------------------------------- /tests/tutorial/ex1-1.typ: -------------------------------------------------------------------------------- 1 | struct message { 2 | struct message *next; 3 | char *buffer; 4 | }; 5 | 6 | struct message_box { 7 | int length; 8 | struct message *first; 9 | }; 10 | 11 | void zeros_buffer(struct message_box + box); 12 | void main(); 13 | -------------------------------------------------------------------------------- /tests/tutorial/ex1-2.typ: -------------------------------------------------------------------------------- 1 | struct message { 2 | struct message *next; 3 | char *buffer; 4 | }; 5 | 6 | struct message_box { 7 | integer with self >= 0 length; 8 | struct message *first; 9 | }; 10 | 11 | void zeros_buffer(struct message_box * box); 12 | -------------------------------------------------------------------------------- /tests/tutorial/ex1-3.typ: -------------------------------------------------------------------------------- 1 | struct message { 2 | struct message+ next; 3 | char+ buffer; 4 | }; 5 | 6 | struct message_box { 7 | integer with self >= 0 length; 8 | struct message+ first; 9 | }; 10 | 11 | void zeros_buffer(struct message_box+ box); 12 | -------------------------------------------------------------------------------- /tests/tutorial/ex1-4.typ: -------------------------------------------------------------------------------- 1 | type struct message = 2 | ∃ len:integer with self >= 0. ( 3 | struct { 4 | struct message+ next; 5 | char[len]+ buffer; 6 | }) 7 | 8 | struct message_box { 9 | integer with self >= 0 length; 10 | struct message+ first; 11 | }; 12 | 13 | void zeros_buffer(struct message_box+ box); 14 | -------------------------------------------------------------------------------- /tests/tutorial/ex1-5.typ: -------------------------------------------------------------------------------- 1 | struct message (len) { 2 | struct message(len)+ next; 3 | char[len]+ buffer; 4 | }; 5 | 6 | ∃ len:integer with self > 0. 7 | struct message_box { 8 | integer with self = len length; 9 | struct message(len)+ first; 10 | }; 11 | 12 | void zeros_buffer(struct message_box+ box); 13 | -------------------------------------------------------------------------------- /tests/tutorial/ex1.c: -------------------------------------------------------------------------------- 1 | struct message { 2 | struct message *next; 3 | char *buffer; 4 | }; 5 | 6 | struct message_box { 7 | int length; 8 | struct message *first; 9 | }; 10 | 11 | void zeros_buffer(struct message_box * box) { 12 | 13 | struct message * first = box->first; 14 | struct message * current = first; 15 | 16 | int length = box->length; 17 | 18 | do { 19 | for (int i = 0; ibuffer[i] = 0 ; 21 | } 22 | current = current->next; 23 | } while(current != first) ; 24 | } 25 | -------------------------------------------------------------------------------- /tests/tutorial/ex1.typ: -------------------------------------------------------------------------------- 1 | struct message { 2 | struct message *next; 3 | char *buffer; 4 | }; 5 | 6 | struct message_box { 7 | int length; 8 | struct message *first; 9 | }; 10 | 11 | void zeros_buffer(struct message_box *box); 12 | int main(void); 13 | -------------------------------------------------------------------------------- /tests/tutorial/ex1_full.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct message { 4 | struct message *next; 5 | char *buffer; 6 | }; 7 | 8 | struct message_box { 9 | int length; 10 | struct message *first; 11 | }; 12 | 13 | void zeros_buffer(struct message_box * box) { 14 | 15 | struct message * first = box->first; 16 | struct message * current = first; 17 | 18 | int length = box->length; 19 | 20 | do { 21 | for (int i = 0; ibuffer[i] = 0 ; 23 | } 24 | current = current->next; 25 | } while(current != first) ; 26 | } 27 | 28 | int main(void) { 29 | // Allocates the message box 30 | struct message_box *box = malloc(sizeof(struct message_box)); 31 | box->length = 20; 32 | box->first = NULL; 33 | for (int i = 0; i < 10; i++) { 34 | struct message *lst = malloc(sizeof(struct message)); 35 | lst->buffer = malloc(sizeof(char) * box->length); 36 | lst->next = box->first; 37 | box->first = lst; 38 | } 39 | 40 | // Fills the content of message box with zeros 41 | zeros_buffer(box); 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /tests/tutorial/ex1_full.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codex-semantics-library/codex/f44de9fce2692ab77a1583e0a485327ab956d861/tests/tutorial/ex1_full.exe -------------------------------------------------------------------------------- /tests/types/aliasing.c: -------------------------------------------------------------------------------- 1 | void test(int * a, int * b) { 2 | *a = *b ; 3 | __VERIFIER_assert (*a == 3) ; 4 | //__VERIFIER_flush_cache () ; 5 | } 6 | 7 | void main(){} 8 | 9 | -------------------------------------------------------------------------------- /tests/types/aliasing2.c: -------------------------------------------------------------------------------- 1 | void test(int ** a, int * b) { 2 | *a = b ; 3 | **a = *b ; 4 | } 5 | 6 | void test2(int * a) { 7 | *a = 4 ; 8 | } 9 | 10 | void main(){} 11 | -------------------------------------------------------------------------------- /tests/types/aliasing2_test2_aliasing2_types.cdump: -------------------------------------------------------------------------------- 1 | aliasing2.c:7.3-4: `a' -> ([1..0xFFFFFFFF] : ({self : Name(bar)[{0}].(0)* | (self != 0)})) 2 | Unproved regular alarms: 3 | Unproved additional alarms: 4 | + Return -> typing_store ; 5 | Proved 1/1 regular alarms 6 | Unproved 0 regular alarms and 1 additional alarms. 7 | Solved 0/0 user assertions, proved 0 8 | -------------------------------------------------------------------------------- /tests/types/aliasing2_test_aliasing2_types.cdump: -------------------------------------------------------------------------------- 1 | aliasing2.c:2.3-4: `a' -> ([1..0xFFFFFFFF] : 2 | ({self : Name(bar)* with (self != 0)[{0}].(0)* | (self != 0)})) 3 | aliasing2.c:2.7-8: `b' -> ([1..0xFFFFFFFF] : ({self : Name(foo)[{0}].(0)* | (self != 0)})) 4 | aliasing2.c:3.3-5: `*a' -> ([1..0xFFFFFFFF] : ({self : Name(foo)[{0}].(0)* | (self != 0)})) 5 | aliasing2.c:3.4-5: `a' -> ([1..0xFFFFFFFF] : 6 | ({self : Name(bar)* with (self != 0)[{0}].(0)* | (self != 0)})) 7 | aliasing2.c:3.8-10: `*b' -> [--..--] 8 | aliasing2.c:3.9-10: `b' -> ([1..0xFFFFFFFF] : ({self : Name(foo)[{0}].(0)* | (self != 0)})) 9 | Unproved regular alarms: 10 | Unproved additional alarms: 11 | Proved 4/4 regular alarms 12 | Unproved 0 regular alarms and 0 additional alarms. 13 | Solved 0/0 user assertions, proved 0 14 | -------------------------------------------------------------------------------- /tests/types/aliasing2_types.c: -------------------------------------------------------------------------------- 1 | type foo = int 2 | 3 | type bar = foo with self = 3 4 | 5 | void test(bar++ a, foo+ b); 6 | 7 | void test2(bar+ a); 8 | -------------------------------------------------------------------------------- /tests/types/aliasing_test_aliasing_types.cdump: -------------------------------------------------------------------------------- 1 | aliasing.c:2.3-4: `a' -> ([1..0xFFFFFFFF] : ({self : Name(foo)[{0}].(0)* | (self != 0)})) 2 | aliasing.c:2.7-9: `*b' -> [--..--] 3 | aliasing.c:2.8-9: `b' -> ([1..0xFFFFFFFF] : ({self : Name(num)[{0}].(0)* | (self != 0)})) 4 | aliasing.c:3.21-28: `*a == 3' -> {0; 1} 5 | aliasing.c:3.21-23: `*a' -> [--..--] 6 | aliasing.c:3.22-23: `a' -> ([1..0xFFFFFFFF] : ({self : Name(foo)[{0}].(0)* | (self != 0)})) 7 | Unproved regular alarms: 8 | Unproved additional alarms: 9 | Proved 3/3 regular alarms 10 | Unproved 0 regular alarms and 0 additional alarms. 11 | aliasing.c:3: assertion is FALSE (counter-example exists) (proved with smt solving) 12 | Solved 1/1 user assertions, proved 0 13 | -------------------------------------------------------------------------------- /tests/types/aliasing_types.c: -------------------------------------------------------------------------------- 1 | type num = int 2 | type foo = num with self = 3 3 | 4 | void test(foo+ a, num+ b); 5 | -------------------------------------------------------------------------------- /tests/types/assert.c: -------------------------------------------------------------------------------- 1 | void test_eq(int * a) { 2 | int c = *a ; 3 | __VERIFIER_assert(c == c) ; 4 | //__VERIFIER_flush_cache() ; 5 | } 6 | 7 | void test_eq2(int * a) { 8 | int c = *a ; 9 | int d = c ; 10 | __VERIFIER_assert(c == d) ; 11 | //__VERIFIER_flush_cache() ; 12 | } 13 | 14 | void test_eq_to_4(int * a) { 15 | __VERIFIER_assert(*a == 4) ; 16 | //__VERIFIER_flush_cache() ; 17 | } 18 | 19 | void test_load_eq(int * a) { 20 | int c = *a ; 21 | int d = *a ; 22 | __VERIFIER_assert(c == d) ; 23 | //__VERIFIER_flush_cache() ; 24 | } 25 | 26 | void main() {} 27 | 28 | -------------------------------------------------------------------------------- /tests/types/assert2.c: -------------------------------------------------------------------------------- 1 | void assert_plus10(int * a) { 2 | int i = *a ; 3 | int res = i + 10 ; 4 | __VERIFIER_assert (res) ; 5 | } 6 | 7 | void assert_eq(void ** a, void ** b) { 8 | __VERIFIER_assert(a == b) ; 9 | } 10 | 11 | void assert_assign(void ** a) { 12 | int c = *a ; 13 | int d = *a ; 14 | __VERIFIER_assert(c == d) ; 15 | __VERIFIER_flush_cache() ; 16 | } 17 | 18 | void main() {} 19 | -------------------------------------------------------------------------------- /tests/types/assert2_assert_assign_assert2_types.cdump: -------------------------------------------------------------------------------- 1 | assert2.c:12.9-11: `(int)*a' -> [--..--] 2 | assert2.c:12.9-11: `*a' -> [--..--] 3 | assert2.c:12.10-11: `a' -> {0} or ([1..0xFFFFFFFF] : (int(4))[{0}].0*) 4 | assert2.c:13.9-11: `(int)*a' -> [--..--] 5 | assert2.c:13.9-11: `*a' -> [--..--] 6 | assert2.c:13.10-11: `a' -> ([1..0xFFFFFFFF] : (int(4))[{0}].0*) 7 | assert2.c:14.19-25: `c == d' -> {0x1} 8 | assert2.c:14.19-20: `c' -> [--..--] 9 | assert2.c:14.24-25: `d' -> [--..--] 10 | Unproved regular alarms: 11 | assert2.c:12: Memory_access(*a, read) {true;false} 12 | Unproved additional alarms: 13 | Proved 1/2 regular alarms 14 | Unproved 1 regular alarms and 0 additional alarms. 15 | assert2.c:14: assertion is TRUE (valid) (proved with abstract interpretation) 16 | Solved 1/1 user assertions, proved 1 17 | -------------------------------------------------------------------------------- /tests/types/assert2_assert_eq_assert2_types.cdump: -------------------------------------------------------------------------------- 1 | assert2.c:8.20-26: `a == b' -> {0; 1} 2 | assert2.c:8.20-21: `a' -> {0} or ([1..0xFFFFFFFF] : (int(4))[{0}].0*) 3 | assert2.c:8.25-26: `b' -> {0} or ([1..0xFFFFFFFF] : (int(4))[{0}].0*) 4 | Unproved regular alarms: 5 | Unproved additional alarms: 6 | Proved 0/0 regular alarms 7 | Unproved 0 regular alarms and 0 additional alarms. 8 | assert2.c:8: assertion is FALSE (counter-example exists) (proved with smt solving) 9 | Solved 1/1 user assertions, proved 0 10 | -------------------------------------------------------------------------------- /tests/types/assert2_assert_plus10_assert2_types.cdump: -------------------------------------------------------------------------------- 1 | assert2.c:2.9-11: `*a' -> [--..--] 2 | assert2.c:2.10-11: `a' -> {0} or ([1..0xFFFFFFFF] : (int(4))[{0}].0*) 3 | assert2.c:3.11-17: `i + 10' -> [-0x7FFFFFF6..0x7FFFFFFF] 4 | assert2.c:3.11-12: `i' -> [--..--] 5 | assert2.c:4.20-23: `res' -> [-0x7FFFFFF6..0x7FFFFFFF] 6 | Unproved regular alarms: 7 | assert2.c:2: Memory_access(*a, read) {true;false} 8 | Unproved additional alarms: 9 | Proved 0/1 regular alarms 10 | Unproved 1 regular alarms and 0 additional alarms. 11 | assert2.c:4: assertion is FALSE (counter-example exists) (proved with smt solving) 12 | Solved 1/1 user assertions, proved 0 13 | -------------------------------------------------------------------------------- /tests/types/assert2_types.c: -------------------------------------------------------------------------------- 1 | void assert_plus10(int * a) ; 2 | void assert_eq(int * a, int * b) ; 3 | void assert_assign(int * a) ; 4 | -------------------------------------------------------------------------------- /tests/types/assert3.c: -------------------------------------------------------------------------------- 1 | struct pair { 2 | int a ; 3 | int b ; 4 | }; 5 | 6 | void test1(struct pair * ptr) { 7 | __VERIFIER_assert (ptr->a == ptr->b) ; 8 | } 9 | 10 | // /!\ p = pair? not pair+ 11 | void test2(struct pair * ptr) { 12 | struct pair p = *ptr ; 13 | if (ptr + 4 > 0) { 14 | int b = ptr->b ; 15 | __VERIFIER_assert (ptr->a == b) ; 16 | } 17 | } 18 | 19 | void test3() { 20 | int i; 21 | int* value = &i; 22 | __VERIFIER_assert(value == 0) ; 23 | } 24 | 25 | void main() {} 26 | -------------------------------------------------------------------------------- /tests/types/assert3_test1_assert3_types.cdump: -------------------------------------------------------------------------------- 1 | assert3.c:7.21-37: `ptr->a == ptr->b' -> {0x1} 2 | assert3.c:7.21-27: `ptr->a' -> [--..--] 3 | assert3.c:7.21-24: `ptr' -> ([1..0xFFFFFFFF] : ({self : Name(paireq)[{0}].(0)* | (self != 0)})) 4 | assert3.c:7.31-37: `ptr->b' -> [--..--] 5 | assert3.c:7.31-34: `ptr' -> ([1..0xFFFFFFFF] : ({self : Name(paireq)[{0}].(0)* | (self != 0)})) 6 | Unproved regular alarms: 7 | Unproved additional alarms: 8 | Proved 2/2 regular alarms 9 | Unproved 0 regular alarms and 0 additional alarms. 10 | assert3.c:7: assertion is TRUE (valid) (proved with abstract interpretation) 11 | Solved 1/1 user assertions, proved 1 12 | -------------------------------------------------------------------------------- /tests/types/assert3_test2_assert3_types.cdump: -------------------------------------------------------------------------------- 1 | assert3.c:12.18-22: `*ptr' -> Concat [{ 32 -> [--..--] of size 32 }; { 0 -> [--..--] of size 32 }] 2 | assert3.c:12.19-22: `ptr' -> ([1..0xFFFFFFFF] : ({self : Name(paireq)[{0}].(0)* | (self != 0)})) 3 | assert3.c:13.6-17: `ptr + 4 > (struct pair *)0' -> {0; 1} 4 | assert3.c:13.6-13: `ptr + 4' -> ([1..0xFFFFFFFF] : ({self : Name(paireq)[{0}].(0)* | (self != 0)})) + 0x20 5 | assert3.c:13.6-9: `ptr' -> ([1..0xFFFFFFFF] : ({self : Name(paireq)[{0}].(0)* | (self != 0)})) 6 | assert3.c:14.12-18: `ptr->b' -> [--..--] 7 | assert3.c:14.12-15: `ptr' -> ([1..0xFFFFFFDF] : ({self : Name(paireq)[{0}].(0)* | (self != 0)})) 8 | assert3.c:15.23-34: `ptr->a == b' -> {0x1} 9 | assert3.c:15.23-29: `ptr->a' -> [--..--] 10 | assert3.c:15.23-26: `ptr' -> ([1..0xFFFFFFDF] : ({self : Name(paireq)[{0}].(0)* | (self != 0)})) 11 | assert3.c:15.33-34: `b' -> [--..--] 12 | Unproved regular alarms: 13 | Unproved additional alarms: 14 | Proved 3/3 regular alarms 15 | Unproved 0 regular alarms and 0 additional alarms. 16 | assert3.c:15: assertion is TRUE (valid) (proved with abstract interpretation) 17 | Solved 1/1 user assertions, proved 1 18 | -------------------------------------------------------------------------------- /tests/types/assert3_test3_assert3_types.cdump: -------------------------------------------------------------------------------- 1 | assert3.c:22.20-30: `value == (int *)0' -> {0x0} 2 | assert3.c:22.20-25: `value' -> {{ &i }} 3 | Unproved regular alarms: 4 | Unproved additional alarms: 5 | Proved 0/0 regular alarms 6 | Unproved 0 regular alarms and 0 additional alarms. 7 | assert3.c:22: assertion is FALSE (invalid) (proved with abstract interpretation) 8 | Solved 1/1 user assertions, proved 0 9 | -------------------------------------------------------------------------------- /tests/types/assert3_types.c: -------------------------------------------------------------------------------- 1 | type paireq = ∃ a:int. struct { 2 | (int with self = a) x; 3 | (int with self = a) y; 4 | } 5 | 6 | void test1(paireq+ p); 7 | 8 | void test2(paireq+ p); 9 | 10 | void test3(); 11 | -------------------------------------------------------------------------------- /tests/types/assert4.c: -------------------------------------------------------------------------------- 1 | void test_eq(int * a, int * b) { 2 | int c = *a ; 3 | int d = *b ; 4 | __VERIFIER_assert(c == d) ; 5 | //__VERIFIER_flush_cache() ; 6 | } 7 | 8 | void test_diff(int * a, int * b) { 9 | int c = *a ; 10 | int d = *b ; 11 | __VERIFIER_assert(c != d) ; 12 | //__VERIFIER_flush_cache() ; 13 | } 14 | 15 | void main() {} 16 | 17 | -------------------------------------------------------------------------------- /tests/types/assert4_test_diff_assert4_types.cdump: -------------------------------------------------------------------------------- 1 | assert4.c:9.9-11: `*a' -> {1} 2 | assert4.c:9.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : Name(int1)[{0}].(0)* | (self != 0)})) 3 | assert4.c:10.9-11: `*b' -> {3} 4 | assert4.c:10.10-11: `b' -> ([1..0xFFFFFFFF] : ({self : Name(int3)[{0}].(0)* | (self != 0)})) 5 | assert4.c:11.19-25: `c != d' -> {0x1} 6 | assert4.c:11.19-20: `c' -> {1} 7 | assert4.c:11.24-25: `d' -> {3} 8 | Unproved regular alarms: 9 | Unproved additional alarms: 10 | Proved 2/2 regular alarms 11 | Unproved 0 regular alarms and 0 additional alarms. 12 | assert4.c:11: assertion is TRUE (valid) (proved with abstract interpretation) 13 | Solved 1/1 user assertions, proved 1 14 | -------------------------------------------------------------------------------- /tests/types/assert4_test_diff_assert4_types2.cdump: -------------------------------------------------------------------------------- 1 | assert4.c:9.9-11: `*a' -> {1} 2 | assert4.c:9.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : Name(int1)[{0}].(0)* | (self != 0)})) 3 | assert4.c:10.9-11: `*b' -> [-0x80000000..1] 4 | assert4.c:10.10-11: `b' -> ([1..0xFFFFFFFF] : ({self : Name(inf2)[{0}].(0)* | (self != 0)})) 5 | assert4.c:11.19-25: `c != d' -> {0; 1} 6 | assert4.c:11.19-20: `c' -> {1} 7 | assert4.c:11.24-25: `d' -> [-0x80000000..1] 8 | Unproved regular alarms: 9 | Unproved additional alarms: 10 | Proved 2/2 regular alarms 11 | Unproved 0 regular alarms and 0 additional alarms. 12 | assert4.c:11: assertion is FALSE (counter-example exists) (proved with smt solving) 13 | Solved 1/1 user assertions, proved 0 14 | -------------------------------------------------------------------------------- /tests/types/assert4_test_eq_assert4_types.cdump: -------------------------------------------------------------------------------- 1 | assert4.c:2.9-11: `*a' -> {1} 2 | assert4.c:2.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : Name(int1)[{0}].(0)* | (self != 0)})) 3 | assert4.c:3.9-11: `*b' -> {3} 4 | assert4.c:3.10-11: `b' -> ([1..0xFFFFFFFF] : ({self : Name(int3)[{0}].(0)* | (self != 0)})) 5 | assert4.c:4.19-25: `c == d' -> {0x0} 6 | assert4.c:4.19-20: `c' -> {1} 7 | assert4.c:4.24-25: `d' -> {3} 8 | Unproved regular alarms: 9 | Unproved additional alarms: 10 | Proved 2/2 regular alarms 11 | Unproved 0 regular alarms and 0 additional alarms. 12 | assert4.c:4: assertion is FALSE (invalid) (proved with abstract interpretation) 13 | Solved 1/1 user assertions, proved 0 14 | -------------------------------------------------------------------------------- /tests/types/assert4_test_eq_assert4_types2.cdump: -------------------------------------------------------------------------------- 1 | assert4.c:2.9-11: `*a' -> {1} 2 | assert4.c:2.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : Name(int1)[{0}].(0)* | (self != 0)})) 3 | assert4.c:3.9-11: `*b' -> [-0x80000000..1] 4 | assert4.c:3.10-11: `b' -> ([1..0xFFFFFFFF] : ({self : Name(inf2)[{0}].(0)* | (self != 0)})) 5 | assert4.c:4.19-25: `c == d' -> {0; 1} 6 | assert4.c:4.19-20: `c' -> {1} 7 | assert4.c:4.24-25: `d' -> [-0x80000000..1] 8 | Unproved regular alarms: 9 | Unproved additional alarms: 10 | Proved 2/2 regular alarms 11 | Unproved 0 regular alarms and 0 additional alarms. 12 | assert4.c:4: assertion is FALSE (counter-example exists) (proved with smt solving) 13 | Solved 1/1 user assertions, proved 0 14 | -------------------------------------------------------------------------------- /tests/types/assert4_types.c: -------------------------------------------------------------------------------- 1 | type int1 = int with self = 1 2 | type int3 = int with self = 3 3 | 4 | void test_eq(int1+ a, int3+ b); 5 | void test_diff(int1+ a, int3+ b); 6 | 7 | -------------------------------------------------------------------------------- /tests/types/assert4_types2.c: -------------------------------------------------------------------------------- 1 | type int1 = int with self = 1 2 | type inf2 = int with self < 2 3 | 4 | void test_eq(int1+ a, inf2+ b); 5 | void test_diff(int1+ a, inf2+ b); 6 | 7 | -------------------------------------------------------------------------------- /tests/types/assert4_types3.c: -------------------------------------------------------------------------------- 1 | type int3 = int with self = 3 2 | type inf2 = int with self < 2 3 | 4 | void test_eq(int3+ a, inf2+ b); 5 | void test_diff(int3+ a, inf2+ b); 6 | 7 | -------------------------------------------------------------------------------- /tests/types/assert4_types4.c: -------------------------------------------------------------------------------- 1 | type inf2 = int with self < 2 2 | type inf10 = int with self < 10 3 | 4 | void test_eq(inf2+ a, inf10+ b); 5 | void test_diff(inf2+ a, inf10+ b); 6 | 7 | -------------------------------------------------------------------------------- /tests/types/assert4_types5.c: -------------------------------------------------------------------------------- 1 | type inf3 = int with self < 3 2 | type sup1 = int with self > 1 3 | 4 | void test_eq(inf3+ a, sup1+ b); 5 | void test_diff(inf3+ a, sup1+ b); 6 | 7 | -------------------------------------------------------------------------------- /tests/types/assert4_types6.c: -------------------------------------------------------------------------------- 1 | void test_eq(int+ a, int+ b); 2 | void test_diff(int+ a, int+ b); 3 | 4 | -------------------------------------------------------------------------------- /tests/types/assert4_types7.c: -------------------------------------------------------------------------------- 1 | type int1 = int with self = 1 2 | 3 | void test_eq(int1+ a, int1+ b); 4 | void test_diff(int1+ a, int1+ b); 5 | 6 | -------------------------------------------------------------------------------- /tests/types/assert_test_eq2_assert_types.cdump: -------------------------------------------------------------------------------- 1 | assert.c:8.9-11: `*a' -> [--..--] 2 | assert.c:8.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 3 | assert.c:9.9-10: `c' -> [--..--] 4 | assert.c:10.19-25: `c == d' -> {0x1} 5 | assert.c:10.19-20: `c' -> [--..--] 6 | assert.c:10.24-25: `d' -> [--..--] 7 | Unproved regular alarms: 8 | Unproved additional alarms: 9 | Proved 1/1 regular alarms 10 | Unproved 0 regular alarms and 0 additional alarms. 11 | assert.c:10: assertion is TRUE (valid) (proved with abstract interpretation) 12 | Solved 1/1 user assertions, proved 1 13 | -------------------------------------------------------------------------------- /tests/types/assert_test_eq2_assert_types2.cdump: -------------------------------------------------------------------------------- 1 | assert.c:8.9-11: `*a' -> {1} 2 | assert.c:8.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : Name(int1)[{0}].(0)* | (self != 0)})) 3 | assert.c:9.9-10: `c' -> {1} 4 | assert.c:10.19-25: `c == d' -> {0x1} 5 | assert.c:10.19-20: `c' -> {1} 6 | assert.c:10.24-25: `d' -> {1} 7 | Unproved regular alarms: 8 | Unproved additional alarms: 9 | Proved 1/1 regular alarms 10 | Unproved 0 regular alarms and 0 additional alarms. 11 | assert.c:10: assertion is TRUE (valid) (proved with abstract interpretation) 12 | Solved 1/1 user assertions, proved 1 13 | -------------------------------------------------------------------------------- /tests/types/assert_test_eq_assert_types.cdump: -------------------------------------------------------------------------------- 1 | assert.c:2.9-11: `*a' -> [--..--] 2 | assert.c:2.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 3 | assert.c:3.19-25: `c == c' -> {0x1} 4 | assert.c:3.19-20: `c' -> [--..--] 5 | assert.c:3.24-25: `c' -> [--..--] 6 | Unproved regular alarms: 7 | Unproved additional alarms: 8 | Proved 1/1 regular alarms 9 | Unproved 0 regular alarms and 0 additional alarms. 10 | assert.c:3: assertion is TRUE (valid) (proved with abstract interpretation) 11 | Solved 1/1 user assertions, proved 1 12 | -------------------------------------------------------------------------------- /tests/types/assert_test_eq_assert_types2.cdump: -------------------------------------------------------------------------------- 1 | assert.c:2.9-11: `*a' -> {1} 2 | assert.c:2.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : Name(int1)[{0}].(0)* | (self != 0)})) 3 | assert.c:3.19-25: `c == c' -> {0x1} 4 | assert.c:3.19-20: `c' -> {1} 5 | assert.c:3.24-25: `c' -> {1} 6 | Unproved regular alarms: 7 | Unproved additional alarms: 8 | Proved 1/1 regular alarms 9 | Unproved 0 regular alarms and 0 additional alarms. 10 | assert.c:3: assertion is TRUE (valid) (proved with abstract interpretation) 11 | Solved 1/1 user assertions, proved 1 12 | -------------------------------------------------------------------------------- /tests/types/assert_test_eq_to_4_assert_types.cdump: -------------------------------------------------------------------------------- 1 | assert.c:15.19-26: `*a == 4' -> {0; 1} 2 | assert.c:15.19-21: `*a' -> [--..--] 3 | assert.c:15.20-21: `a' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 4 | Unproved regular alarms: 5 | Unproved additional alarms: 6 | Proved 1/1 regular alarms 7 | Unproved 0 regular alarms and 0 additional alarms. 8 | assert.c:15: assertion is FALSE (counter-example exists) (proved with smt solving) 9 | Solved 1/1 user assertions, proved 0 10 | -------------------------------------------------------------------------------- /tests/types/assert_test_eq_to_4_assert_types2.cdump: -------------------------------------------------------------------------------- 1 | assert.c:15.19-26: `*a == 4' -> {0x0} 2 | assert.c:15.19-21: `*a' -> {1} 3 | assert.c:15.20-21: `a' -> ([1..0xFFFFFFFF] : ({self : Name(int1)[{0}].(0)* | (self != 0)})) 4 | Unproved regular alarms: 5 | Unproved additional alarms: 6 | Proved 1/1 regular alarms 7 | Unproved 0 regular alarms and 0 additional alarms. 8 | assert.c:15: assertion is FALSE (invalid) (proved with abstract interpretation) 9 | Solved 1/1 user assertions, proved 0 10 | -------------------------------------------------------------------------------- /tests/types/assert_test_load_eq_assert_types.cdump: -------------------------------------------------------------------------------- 1 | assert.c:20.9-11: `*a' -> [--..--] 2 | assert.c:20.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 3 | assert.c:21.9-11: `*a' -> [--..--] 4 | assert.c:21.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 5 | assert.c:22.19-25: `c == d' -> {0x1} 6 | assert.c:22.19-20: `c' -> [--..--] 7 | assert.c:22.24-25: `d' -> [--..--] 8 | Unproved regular alarms: 9 | Unproved additional alarms: 10 | Proved 2/2 regular alarms 11 | Unproved 0 regular alarms and 0 additional alarms. 12 | assert.c:22: assertion is TRUE (valid) (proved with abstract interpretation) 13 | Solved 1/1 user assertions, proved 1 14 | -------------------------------------------------------------------------------- /tests/types/assert_test_load_eq_assert_types2.cdump: -------------------------------------------------------------------------------- 1 | assert.c:20.9-11: `*a' -> {1} 2 | assert.c:20.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : Name(int1)[{0}].(0)* | (self != 0)})) 3 | assert.c:21.9-11: `*a' -> {1} 4 | assert.c:21.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : Name(int1)[{0}].(0)* | (self != 0)})) 5 | assert.c:22.19-25: `c == d' -> {0x1} 6 | assert.c:22.19-20: `c' -> {1} 7 | assert.c:22.24-25: `d' -> {1} 8 | Unproved regular alarms: 9 | Unproved additional alarms: 10 | Proved 2/2 regular alarms 11 | Unproved 0 regular alarms and 0 additional alarms. 12 | assert.c:22: assertion is TRUE (valid) (proved with abstract interpretation) 13 | Solved 1/1 user assertions, proved 1 14 | -------------------------------------------------------------------------------- /tests/types/assert_types.c: -------------------------------------------------------------------------------- 1 | void test_eq(int+ a); 2 | void test_eq2(int+ a); 3 | void test_eq_to_4(int+ a); 4 | void test_load_eq(int+ a); 5 | 6 | -------------------------------------------------------------------------------- /tests/types/assert_types1.c: -------------------------------------------------------------------------------- 1 | type int = int with self = 1 2 | 3 | void test_eq(int+ a); 4 | void test_eq2(int+ a, int+ b); 5 | void test_eq3(int+ a); 6 | void test_diff(int+ a, int+ b); 7 | void test_eq_to_4(int+ a); 8 | void test_load_eq(int+ a); 9 | 10 | -------------------------------------------------------------------------------- /tests/types/assert_types2.c: -------------------------------------------------------------------------------- 1 | type int1 = int with self = 1 2 | 3 | void test_eq(int1+ a); 4 | void test_eq2(int1+ a); 5 | void test_eq_to_4(int1+ a); 6 | void test_load_eq(int1+ a); 7 | 8 | -------------------------------------------------------------------------------- /tests/types/assert_types3.c: -------------------------------------------------------------------------------- 1 | type int1 = int with self = 1 2 | type int3 = int with self = 3 3 | 4 | void test_eq2(int1+ a, int3+ b); 5 | void test_diff(int1+ a, int3+ b); 6 | 7 | -------------------------------------------------------------------------------- /tests/types/assert_types4.c: -------------------------------------------------------------------------------- 1 | type int1 = int with self = 1 2 | type inf2 = int with self < 2 3 | 4 | void test_eq2(int1+ a, inf2+ b); 5 | void test_diff(int1+ a, inf2+ b); 6 | 7 | -------------------------------------------------------------------------------- /tests/types/assert_types5.c: -------------------------------------------------------------------------------- 1 | type int3 = int with self = 3 2 | type inf2 = int with self < 2 3 | 4 | void test_eq2(int3+ a, inf2+ b); 5 | void test_diff(int3+ a, inf2+ b); 6 | 7 | -------------------------------------------------------------------------------- /tests/types/assert_types6.c: -------------------------------------------------------------------------------- 1 | type inf2 = int with self < 2 2 | type inf10 = int with self < 10 3 | 4 | void test_eq2(inf2+ a, inf10+ b); 5 | void test_diff(inf2+ a, inf10+ b); 6 | 7 | -------------------------------------------------------------------------------- /tests/types/assert_types7.c: -------------------------------------------------------------------------------- 1 | type inf3 = int with self < 3 2 | type sup1 = int with self > 1 3 | 4 | void test_eq2(inf3+ a, sup1+ b); 5 | void test_diff(inf3+ a, sup1+ b); 6 | 7 | -------------------------------------------------------------------------------- /tests/types/assume.c: -------------------------------------------------------------------------------- 1 | typedef struct foo { 2 | int tag ; 3 | int data ; 4 | } foo ; 5 | 6 | void test(struct foo * ptr) { 7 | //__VERIFIER_assert (ptr->data) ; 8 | if (ptr->tag == 0) { 9 | __VERIFIER_assert(ptr->data == 100) ; 10 | } 11 | else { 12 | __VERIFIER_assert(ptr->data == 200) ; 13 | } 14 | //__VERIFIER_flush_cache () ; 15 | } 16 | 17 | int main(void) { 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /tests/types/assume_test_assume_types.cdump: -------------------------------------------------------------------------------- 1 | assume.c:8.5-18: `ptr->tag == 0' -> {0; 1} 2 | assume.c:8.5-13: `ptr->tag' -> [--..--] 3 | assume.c:8.5-8: `ptr' -> {0} or ([1..0xFFFFFFFF] : (Name(struct foo))[{0}].0*) 4 | assume.c:9.21-37: `ptr->data == 100' -> {0; 1} 5 | assume.c:9.21-30: `ptr->data' -> [--..--] 6 | assume.c:9.21-24: `ptr' -> ([1..0xFFFFFFFF] : (Name(struct foo))[{0}].0*) 7 | assume.c:12.21-37: `ptr->data == 200' -> {0; 1} 8 | assume.c:12.21-30: `ptr->data' -> [--..--] 9 | assume.c:12.21-24: `ptr' -> ([1..0xFFFFFFFF] : (Name(struct foo))[{0}].0*) 10 | Unproved regular alarms: 11 | assume.c:8: Memory_access(ptr->tag, read) {true;false} 12 | Unproved additional alarms: 13 | Proved 2/3 regular alarms 14 | Unproved 1 regular alarms and 0 additional alarms. 15 | assume.c:9: assertion is FALSE (counter-example exists) (proved with smt solving) 16 | assume.c:12: assertion is FALSE (counter-example exists) (proved with smt solving) 17 | Solved 2/2 user assertions, proved 0 18 | -------------------------------------------------------------------------------- /tests/types/assume_types.c: -------------------------------------------------------------------------------- 1 | type foo = ∃ a : (nat with self < 2) . (struct { 2 | int with (self = a) tag ; 3 | union { 4 | (int with (self = 100)) with (a = 0) a ; 5 | (int with (self = 200)) with (a != 0) b ; 6 | } data ; 7 | }+) 8 | 9 | void test(foo p); 10 | -------------------------------------------------------------------------------- /tests/types/bad_load.c: -------------------------------------------------------------------------------- 1 | struct pair { 2 | int a; 3 | int b; 4 | }; 5 | 6 | void test1(struct pair *p) { 7 | int a = p->b ; 8 | __VERIFIER_flush_cache () ; 9 | } 10 | 11 | void test2(struct pair *p) { 12 | struct pair a = *p ; 13 | __VERIFIER_flush_cache () ; 14 | } 15 | 16 | void main() {} 17 | -------------------------------------------------------------------------------- /tests/types/bad_load_test1_bad_load_types.cdump: -------------------------------------------------------------------------------- 1 | bad_load.c:7.10-11: `p' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 2 | Unproved regular alarms: 3 | Unproved additional alarms: 4 | + bad_load.c:7 : { int a = p->b; } -> array_offset_access ; 5 | Proved 1/1 regular alarms 6 | Unproved 0 regular alarms and 1 additional alarms. 7 | Solved 0/0 user assertions, proved 0 8 | -------------------------------------------------------------------------------- /tests/types/bad_load_test2_bad_load_types.cdump: -------------------------------------------------------------------------------- 1 | bad_load.c:12.19-20: `p' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 2 | Unproved regular alarms: 3 | Unproved additional alarms: 4 | + bad_load.c:12 : { struct pair a = *p; } -> array_offset_access ; 5 | Proved 1/1 regular alarms 6 | Unproved 0 regular alarms and 1 additional alarms. 7 | Solved 0/0 user assertions, proved 0 8 | -------------------------------------------------------------------------------- /tests/types/bad_load_types.c: -------------------------------------------------------------------------------- 1 | struct pair { 2 | int a; 3 | int b; 4 | }; 5 | 6 | void test1(int+ p); 7 | 8 | void test2(int+ p) ; 9 | -------------------------------------------------------------------------------- /tests/types/bad_loop.c: -------------------------------------------------------------------------------- 1 | void test(int * ptr) { 2 | int i = 0 ; 3 | while (i < -1) { 4 | __VERIFIER_assert(i < -1) ; 5 | i++ ; 6 | } 7 | } 8 | 9 | void main(){} -------------------------------------------------------------------------------- /tests/types/bad_loop_test_bad_loop_types.cdump: -------------------------------------------------------------------------------- 1 | bad_loop.c:3.9-15: `i < -1' -> {0x0} 2 | bad_loop.c:3.9-10: `i' -> {0} 3 | Unproved regular alarms: 4 | Unproved additional alarms: 5 | Proved 0/0 regular alarms 6 | Unproved 0 regular alarms and 0 additional alarms. 7 | Solved 0/0 user assertions, proved 0 8 | -------------------------------------------------------------------------------- /tests/types/bad_loop_types.c: -------------------------------------------------------------------------------- 1 | void test(int * ptr); 2 | 3 | -------------------------------------------------------------------------------- /tests/types/chandra_point.c: -------------------------------------------------------------------------------- 1 | typedef struct { 2 | int x, y ; 3 | } Point ; 4 | 5 | typedef struct { 6 | int x, y, color ; 7 | } ColorPoint ; 8 | 9 | typedef struct { 10 | int common ; 11 | Point * p ; 12 | } PS; 13 | 14 | typedef struct { 15 | int common ; 16 | ColorPoint * p ; 17 | } CPS; 18 | 19 | enum Color {RED , BLUE , GREEN}; 20 | 21 | 22 | void test1(Point * pt, ColorPoint * pcp) { 23 | //Point p = *pt; 24 | __VERIFIER_debug_int32 ((int) pcp) ; 25 | pcp = (ColorPoint *) pt ; 26 | __VERIFIER_debug_int32 ((int) pcp) ; 27 | pcp->x = 1 ; 28 | pcp->color = RED ; 29 | } 30 | 31 | void test2(PS * psp, CPS * cps, CPS * cpsp, Point * pt, Point * q, ColorPoint * cp) { 32 | psp = (PS *) cps ; 33 | cpsp = cps ; 34 | q = pt ; 35 | psp->p = q ; 36 | cp = cpsp->p ; 37 | cp->color = RED ; 38 | } 39 | 40 | void test3(Point * pt, Point ** pp, ColorPoint ** q) { 41 | pp = (Point**) q ; 42 | *pp = pt ; 43 | (*q)->color = RED ; 44 | } 45 | 46 | 47 | void main() {} 48 | -------------------------------------------------------------------------------- /tests/types/chandra_point_test1_chandra_point_types.cdump: -------------------------------------------------------------------------------- 1 | chandra_point.c:24.32-35: `(int)pcp' -> ([1..0xFFFFFFFF] : 2 | ({self : Name(struct ColorPoint)[{0}].(0)* | (self != 0)})) 3 | chandra_point.c:24.32-35: `pcp' -> ([1..0xFFFFFFFF] : 4 | ({self : Name(struct ColorPoint)[{0}].(0)* | (self != 0)})) 5 | chandra_point.c:25.23-25: `(ColorPoint *)pt' -> ([1..0xFFFFFFFF] : ({self : Name(struct Point)[{0}].(0)* | (self != 0)})) 6 | chandra_point.c:25.23-25: `pt' -> ([1..0xFFFFFFFF] : ({self : Name(struct Point)[{0}].(0)* | (self != 0)})) 7 | chandra_point.c:26.32-35: `(int)pcp' -> ([1..0xFFFFFFFF] : ({self : Name(struct Point)[{0}].(0)* | (self != 0)})) 8 | chandra_point.c:26.32-35: `pcp' -> ([1..0xFFFFFFFF] : ({self : Name(struct Point)[{0}].(0)* | (self != 0)})) 9 | chandra_point.c:27.2-5: `pcp' -> ([1..0xFFFFFFFF] : ({self : Name(struct Point)[{0}].(0)* | (self != 0)})) 10 | chandra_point.c:28.2-5: `pcp' -> ([1..0xFFFFFFFF] : ({self : Name(struct Point)[{0}].(0)* | (self != 0)})) 11 | Unproved regular alarms: 12 | Unproved additional alarms: 13 | + chandra_point.c:28 : { pcp->color = RED; } -> array_offset_access ; 14 | Proved 2/2 regular alarms 15 | Unproved 0 regular alarms and 1 additional alarms. 16 | Solved 0/0 user assertions, proved 0 17 | -------------------------------------------------------------------------------- /tests/types/chandra_point_test2_chandra_point_types.cdump: -------------------------------------------------------------------------------- 1 | chandra_point.c:32.15-18: `(PS *)cps' -> ([1..0xFFFFFFFF] : ({self : Name(struct CPS)[{0}].(0)* | (self != 0)})) 2 | chandra_point.c:32.15-18: `cps' -> ([1..0xFFFFFFFF] : ({self : Name(struct CPS)[{0}].(0)* | (self != 0)})) 3 | chandra_point.c:33.9-12: `cps' -> ([1..0xFFFFFFFF] : ({self : Name(struct CPS)[{0}].(0)* | (self != 0)})) 4 | chandra_point.c:34.6-8: `pt' -> ([1..0xFFFFFFFF] : ({self : Name(struct Point)[{0}].(0)* | (self != 0)})) 5 | chandra_point.c:35.2-5: `psp' -> ([1..0xFFFFFFFF] : ({self : Name(struct CPS)[{0}].(0)* | (self != 0)})) 6 | chandra_point.c:35.11-12: `q' -> ([1..0xFFFFFFFF] : ({self : Name(struct Point)[{0}].(0)* | (self != 0)})) 7 | chandra_point.c:36.7-14: `cpsp->p' -> ([1..0xFFFFFFFF] : ({self : Name(struct Point)[{0}].(0)* | (self != 0)})) 8 | chandra_point.c:36.7-11: `cpsp' -> ([1..0xFFFFFFFB] : ({self : Name(struct CPS)[{0}].(0)* | (self != 0)})) 9 | chandra_point.c:37.2-4: `cp' -> ([1..0xFFFFFFFF] : ({self : Name(struct Point)[{0}].(0)* | (self != 0)})) 10 | Unproved regular alarms: 11 | Unproved additional alarms: 12 | + chandra_point.c:37 : { cp->color = RED; } -> array_offset_access ; 13 | Proved 3/3 regular alarms 14 | Unproved 0 regular alarms and 1 additional alarms. 15 | Solved 0/0 user assertions, proved 0 16 | -------------------------------------------------------------------------------- /tests/types/chandra_point_test3_chandra_point_types.cdump: -------------------------------------------------------------------------------- 1 | chandra_point.c:41.17-18: `(Point **)q' -> ([1..0xFFFFFFFF] : 2 | ({self : Name(struct ColorPoint)* with (self != 0)[{0}].(0)* | 3 | (self != 0)})) 4 | chandra_point.c:41.17-18: `q' -> ([1..0xFFFFFFFF] : 5 | ({self : Name(struct ColorPoint)* with (self != 0)[{0}].(0)* | 6 | (self != 0)})) 7 | chandra_point.c:42.3-5: `pp' -> ([1..0xFFFFFFFF] : 8 | ({self : Name(struct ColorPoint)* with (self != 0)[{0}].(0)* | 9 | (self != 0)})) 10 | chandra_point.c:42.8-10: `pt' -> ([1..0xFFFFFFFF] : ({self : Name(struct Point)[{0}].(0)* | (self != 0)})) 11 | chandra_point.c:43.3-5: `*q' -> ([1..0xFFFFFFFF] : ({self : Name(struct Point)[{0}].(0)* | (self != 0)})) 12 | chandra_point.c:43.4-5: `q' -> ([1..0xFFFFFFFF] : 13 | ({self : Name(struct ColorPoint)* with (self != 0)[{0}].(0)* | 14 | (self != 0)})) 15 | Unproved regular alarms: 16 | Unproved additional alarms: 17 | + chandra_point.c:43 : { (*q)->color = RED; } -> array_offset_access ; 18 | Proved 3/3 regular alarms 19 | Unproved 0 regular alarms and 1 additional alarms. 20 | Solved 0/0 user assertions, proved 0 21 | -------------------------------------------------------------------------------- /tests/types/chandra_point_types.c: -------------------------------------------------------------------------------- 1 | struct Point { 2 | int x; 3 | int y ; 4 | }; 5 | 6 | struct ColorPoint { 7 | int x; 8 | int y; 9 | int color ; 10 | }; 11 | 12 | struct PS { 13 | int common ; 14 | struct Point+ p ; 15 | }; 16 | 17 | struct CPS { 18 | int common ; 19 | struct ColorPoint+ p ; 20 | }; 21 | 22 | void test1(struct Point+ pt, struct ColorPoint+ pcp); 23 | 24 | void test2(struct PS+ psp, struct CPS+ cps, struct CPS+ cpsp, struct Point+ pt, struct Point+ q, struct ColorPoint+ cp); 25 | 26 | void test3(struct Point+ pt, struct Point++ pp, struct ColorPoint++ q); 27 | 28 | -------------------------------------------------------------------------------- /tests/types/chandra_radio.c: -------------------------------------------------------------------------------- 1 | typedef struct { 2 | int hour, minute ; 3 | } Clock ; 4 | 5 | typedef struct { 6 | int frequency ; 7 | } Radio ; 8 | 9 | typedef struct { 10 | Clock clock; 11 | Radio radio; 12 | } ClockRadio ; 13 | 14 | 15 | void test(ClockRadio * cl, Clock * c, Radio * r) { 16 | //ClockRadio cr = *cl ; 17 | 18 | c = &(cl->clock) ; 19 | r = (Radio*) c + 1 ; 20 | r->frequency = 91 ; 21 | } 22 | 23 | void main() {} 24 | -------------------------------------------------------------------------------- /tests/types/chandra_radio_test_chandra_radio_types.cdump: -------------------------------------------------------------------------------- 1 | chandra_radio.c:18.7-18: `& cl->clock' -> {0} or ([1..0xFFFFFFFF] : (Name(struct ClockRadio))[{0}].0*) 2 | chandra_radio.c:18.8-10: `cl' -> {0} or ([1..0xFFFFFFFF] : (Name(struct ClockRadio))[{0}].0*) 3 | chandra_radio.c:19.6-20: `(Radio *)c + 1' -> {0} or ([1..0xFFFFFFFF] : (Name(struct ClockRadio))[{0}].0*) + 0x4 4 | chandra_radio.c:19.15-16: `(Radio *)c' -> {0} or ([1..0xFFFFFFFF] : (Name(struct ClockRadio))[{0}].0*) 5 | chandra_radio.c:19.15-16: `c' -> {0} or ([1..0xFFFFFFFF] : (Name(struct ClockRadio))[{0}].0*) 6 | chandra_radio.c:20.2-3: `r' -> {4} or ([5..0xFFFFFFFF] : (Name(struct ClockRadio))[{0}].4*) 7 | Unproved regular alarms: 8 | chandra_radio.c:20: Memory_access(r->frequency, write) {true;false} 9 | Unproved additional alarms: 10 | Proved 0/1 regular alarms 11 | Unproved 1 regular alarms and 0 additional alarms. 12 | Solved 0/0 user assertions, proved 0 13 | -------------------------------------------------------------------------------- /tests/types/chandra_radio_types.c: -------------------------------------------------------------------------------- 1 | struct Clock { 2 | int hour; 3 | int minute ; 4 | }; 5 | 6 | struct Radio { 7 | int frequency ; 8 | }; 9 | 10 | struct ClockRadio { 11 | struct Clock clock; 12 | struct Radio radio; 13 | }; 14 | 15 | void test(struct ClockRadio * cl, struct Clock * c, struct Radio * r); 16 | -------------------------------------------------------------------------------- /tests/types/comp.c: -------------------------------------------------------------------------------- 1 | //#include "binsec-stubs.h" 2 | 3 | void test(int * a) { 4 | //int n = a + 4 ; 5 | int n = (*a) ; 6 | if (0 < n) __VERIFIER_assert (0 < n) ; 7 | else __VERIFIER_assert (0 >= n) ; 8 | } 9 | 10 | void main() {} 11 | -------------------------------------------------------------------------------- /tests/types/comp_types.c: -------------------------------------------------------------------------------- 1 | void test(int+ ptr); 2 | -------------------------------------------------------------------------------- /tests/types/comparison.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | void test_ge(int * a, int * b) { 4 | int i = *a ; 5 | int j = *b ; 6 | if (i >= j) { 7 | __VERIFIER_assert (i >= j) ; 8 | } 9 | } 10 | 11 | void test_lt20(int * num) { 12 | int i = *num ; 13 | if (i < 20) { 14 | __VERIFIER_assert (i < 20) ; 15 | } 16 | } 17 | 18 | void test_gt(int * a, int * b) { 19 | int i = *a ; 20 | int j = *b ; 21 | if (i > j) { 22 | __VERIFIER_assert (i > j) ; 23 | } else { __VERIFIER_assert (i <= j) ; } 24 | } 25 | 26 | void test_gt20(int * num) { 27 | int i = *num ; 28 | if (i > 20) { 29 | __VERIFIER_assert (i > 20) ; 30 | } 31 | } 32 | 33 | void test_le(int * a, int * b) { 34 | int i = *a ; 35 | int j = *b ; 36 | if (i <= j) { 37 | __VERIFIER_assert (i <= j) ; 38 | } else { __VERIFIER_assert (i > j) ; } 39 | } 40 | 41 | void test_le20(int * num) { 42 | int i = *num ; 43 | if (i <= 20) { 44 | __VERIFIER_assert (i <= 20) ; 45 | } 46 | } 47 | 48 | void test_lt0(int * num) { 49 | int n = *num ; 50 | if (0 < n) __VERIFIER_assert (0 < n) ; 51 | else __VERIFIER_assert (0 >= n) ; 52 | } 53 | 54 | void main() {} 55 | -------------------------------------------------------------------------------- /tests/types/comparison2.c: -------------------------------------------------------------------------------- 1 | // 2 | 3 | void test(int * a) { 4 | //int n = a + 4 ; 5 | int n = (*a) ; 6 | if (0 < n) __VERIFIER_assert (0 < n) ; 7 | else __VERIFIER_assert (0 >= n) ; 8 | } 9 | 10 | void main() {} 11 | -------------------------------------------------------------------------------- /tests/types/comparison2_test_comparison2_types.cdump: -------------------------------------------------------------------------------- 1 | comparison2.c:5.10-12: `*a' -> [--..--] 2 | comparison2.c:5.11-12: `a' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 3 | comparison2.c:6.5-10: `0 < n' -> {0; 1} 4 | comparison2.c:6.9-10: `n' -> [--..--] 5 | comparison2.c:6.31-36: `0 < n' -> {0x1} 6 | comparison2.c:6.35-36: `n' -> [1..0x7FFFFFFF] 7 | comparison2.c:7.25-31: `0 >= n' -> {0x1} 8 | comparison2.c:7.30-31: `n' -> [-0x80000000..0] 9 | Unproved regular alarms: 10 | Unproved additional alarms: 11 | Proved 1/1 regular alarms 12 | Unproved 0 regular alarms and 0 additional alarms. 13 | comparison2.c:6: assertion is TRUE (valid) (proved with abstract interpretation) 14 | comparison2.c:7: assertion is TRUE (valid) (proved with abstract interpretation) 15 | Solved 2/2 user assertions, proved 2 16 | -------------------------------------------------------------------------------- /tests/types/comparison2_types.c: -------------------------------------------------------------------------------- 1 | void test(int+ ptr); 2 | -------------------------------------------------------------------------------- /tests/types/comparison3.c: -------------------------------------------------------------------------------- 1 | void test(int * ptr) { 2 | int i = 0 ; 3 | while (i < -1) { 4 | __VERIFIER_assert(i < -1) ; 5 | i++ ; 6 | } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /tests/types/comparison3_test_comparison3_types.cdump: -------------------------------------------------------------------------------- 1 | comparison3.c:3.9-15: `i < -1' -> {0x0} 2 | comparison3.c:3.9-10: `i' -> {0} 3 | Unproved regular alarms: 4 | Unproved additional alarms: 5 | Proved 0/0 regular alarms 6 | Unproved 0 regular alarms and 0 additional alarms. 7 | Solved 0/0 user assertions, proved 0 8 | -------------------------------------------------------------------------------- /tests/types/comparison3_types.c: -------------------------------------------------------------------------------- 1 | void test_ge(int * a, int * b); 2 | 3 | void test_lt20(int * num); 4 | 5 | void test_gt(int * a, int * b); 6 | 7 | void test_gt20(int * num); 8 | 9 | void test_le(int * a, int * b); 10 | 11 | void test_le20(int * num); 12 | 13 | void test_lt0(int * num); 14 | -------------------------------------------------------------------------------- /tests/types/comparison_test_ge_comparison_types.cdump: -------------------------------------------------------------------------------- 1 | comparison.c:4.9-11: `*a' -> [--..--] 2 | comparison.c:4.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 3 | comparison.c:5.9-11: `*b' -> [--..--] 4 | comparison.c:5.10-11: `b' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 5 | comparison.c:6.5-11: `i >= j' -> {0; 1} 6 | comparison.c:6.5-6: `i' -> [--..--] 7 | comparison.c:6.10-11: `j' -> [--..--] 8 | comparison.c:7.22-28: `i >= j' -> {0x1} 9 | comparison.c:7.22-23: `i' -> [--..--] 10 | comparison.c:7.27-28: `j' -> [--..--] 11 | Unproved regular alarms: 12 | Unproved additional alarms: 13 | Proved 2/2 regular alarms 14 | Unproved 0 regular alarms and 0 additional alarms. 15 | comparison.c:7: assertion is TRUE (valid) (proved with abstract interpretation) 16 | Solved 1/1 user assertions, proved 1 17 | -------------------------------------------------------------------------------- /tests/types/comparison_test_gt20_comparison_types.cdump: -------------------------------------------------------------------------------- 1 | comparison.c:27.9-13: `*num' -> [--..--] 2 | comparison.c:27.10-13: `num' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 3 | comparison.c:28.5-11: `i > 20' -> {0; 1} 4 | comparison.c:28.5-6: `i' -> [--..--] 5 | comparison.c:29.22-28: `i > 20' -> {0x1} 6 | comparison.c:29.22-23: `i' -> [21..0x7FFFFFFF] 7 | Unproved regular alarms: 8 | Unproved additional alarms: 9 | Proved 1/1 regular alarms 10 | Unproved 0 regular alarms and 0 additional alarms. 11 | comparison.c:29: assertion is TRUE (valid) (proved with abstract interpretation) 12 | Solved 1/1 user assertions, proved 1 13 | -------------------------------------------------------------------------------- /tests/types/comparison_test_gt_comparison_types.cdump: -------------------------------------------------------------------------------- 1 | comparison.c:19.9-11: `*a' -> [--..--] 2 | comparison.c:19.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 3 | comparison.c:20.9-11: `*b' -> [--..--] 4 | comparison.c:20.10-11: `b' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 5 | comparison.c:21.5-10: `i > j' -> {0; 1} 6 | comparison.c:21.5-6: `i' -> [--..--] 7 | comparison.c:21.9-10: `j' -> [--..--] 8 | comparison.c:22.22-27: `i > j' -> {0x1} 9 | comparison.c:22.22-23: `i' -> [-0x7FFFFFFF..0x7FFFFFFF] 10 | comparison.c:22.26-27: `j' -> [-0x80000000..0x7FFFFFFE] 11 | comparison.c:23.29-35: `i <= j' -> {0x1} 12 | comparison.c:23.29-30: `i' -> [--..--] 13 | comparison.c:23.34-35: `j' -> [--..--] 14 | Unproved regular alarms: 15 | Unproved additional alarms: 16 | Proved 2/2 regular alarms 17 | Unproved 0 regular alarms and 0 additional alarms. 18 | comparison.c:22: assertion is TRUE (valid) (proved with abstract interpretation) 19 | comparison.c:23: assertion is TRUE (valid) (proved with abstract interpretation) 20 | Solved 2/2 user assertions, proved 2 21 | -------------------------------------------------------------------------------- /tests/types/comparison_test_le20_comparison_types.cdump: -------------------------------------------------------------------------------- 1 | comparison.c:42.9-13: `*num' -> [--..--] 2 | comparison.c:42.10-13: `num' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 3 | comparison.c:43.5-12: `i <= 20' -> {0; 1} 4 | comparison.c:43.5-6: `i' -> [--..--] 5 | comparison.c:44.22-29: `i <= 20' -> {0x1} 6 | comparison.c:44.22-23: `i' -> [-0x80000000..20] 7 | Unproved regular alarms: 8 | Unproved additional alarms: 9 | Proved 1/1 regular alarms 10 | Unproved 0 regular alarms and 0 additional alarms. 11 | comparison.c:44: assertion is TRUE (valid) (proved with abstract interpretation) 12 | Solved 1/1 user assertions, proved 1 13 | -------------------------------------------------------------------------------- /tests/types/comparison_test_le_comparison_types.cdump: -------------------------------------------------------------------------------- 1 | comparison.c:34.9-11: `*a' -> [--..--] 2 | comparison.c:34.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 3 | comparison.c:35.9-11: `*b' -> [--..--] 4 | comparison.c:35.10-11: `b' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 5 | comparison.c:36.5-11: `i <= j' -> {0; 1} 6 | comparison.c:36.5-6: `i' -> [--..--] 7 | comparison.c:36.10-11: `j' -> [--..--] 8 | comparison.c:37.22-28: `i <= j' -> {0x1} 9 | comparison.c:37.22-23: `i' -> [--..--] 10 | comparison.c:37.27-28: `j' -> [--..--] 11 | comparison.c:38.29-34: `i > j' -> {0x1} 12 | comparison.c:38.29-30: `i' -> [-0x7FFFFFFF..0x7FFFFFFF] 13 | comparison.c:38.33-34: `j' -> [-0x80000000..0x7FFFFFFE] 14 | Unproved regular alarms: 15 | Unproved additional alarms: 16 | Proved 2/2 regular alarms 17 | Unproved 0 regular alarms and 0 additional alarms. 18 | comparison.c:37: assertion is TRUE (valid) (proved with abstract interpretation) 19 | comparison.c:38: assertion is TRUE (valid) (proved with abstract interpretation) 20 | Solved 2/2 user assertions, proved 2 21 | -------------------------------------------------------------------------------- /tests/types/comparison_test_lt0_comparison_types.cdump: -------------------------------------------------------------------------------- 1 | comparison.c:49.9-13: `*num' -> [--..--] 2 | comparison.c:49.10-13: `num' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 3 | comparison.c:50.5-10: `0 < n' -> {0; 1} 4 | comparison.c:50.9-10: `n' -> [--..--] 5 | comparison.c:50.31-36: `0 < n' -> {0x1} 6 | comparison.c:50.35-36: `n' -> [1..0x7FFFFFFF] 7 | comparison.c:51.25-31: `0 >= n' -> {0x1} 8 | comparison.c:51.30-31: `n' -> [-0x80000000..0] 9 | Unproved regular alarms: 10 | Unproved additional alarms: 11 | Proved 1/1 regular alarms 12 | Unproved 0 regular alarms and 0 additional alarms. 13 | comparison.c:50: assertion is TRUE (valid) (proved with abstract interpretation) 14 | comparison.c:51: assertion is TRUE (valid) (proved with abstract interpretation) 15 | Solved 2/2 user assertions, proved 2 16 | -------------------------------------------------------------------------------- /tests/types/comparison_test_lt20_comparison_types.cdump: -------------------------------------------------------------------------------- 1 | comparison.c:12.9-13: `*num' -> [--..--] 2 | comparison.c:12.10-13: `num' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 3 | comparison.c:13.5-11: `i < 20' -> {0; 1} 4 | comparison.c:13.5-6: `i' -> [--..--] 5 | comparison.c:14.22-28: `i < 20' -> {0x1} 6 | comparison.c:14.22-23: `i' -> [-0x80000000..19] 7 | Unproved regular alarms: 8 | Unproved additional alarms: 9 | Proved 1/1 regular alarms 10 | Unproved 0 regular alarms and 0 additional alarms. 11 | comparison.c:14: assertion is TRUE (valid) (proved with abstract interpretation) 12 | Solved 1/1 user assertions, proved 1 13 | -------------------------------------------------------------------------------- /tests/types/comparison_types.c: -------------------------------------------------------------------------------- 1 | void test_ge(int+ a, int+ b); 2 | 3 | void test_lt20(int+ num); 4 | 5 | void test_gt(int+ a, int+ b); 6 | 7 | void test_gt20(int+ num); 8 | 9 | void test_le(int+ a, int+ b); 10 | 11 | void test_le20(int+ num); 12 | 13 | void test_lt0(int+ num); 14 | -------------------------------------------------------------------------------- /tests/types/counter.c: -------------------------------------------------------------------------------- 1 | // 2 | 3 | void incr(int * a) { 4 | int length = *a ; 5 | int n = 0 ; 6 | for (int i = 0; i < length; i++) { 7 | __VERIFIER_assert(n == i) ; 8 | n++; 9 | } 10 | //for (int i = 0 ; i < length; i = i + 1) ; 11 | //__VERIFIER_assert(n == length) ; 12 | } 13 | 14 | void incr2(int * a, int * b) { 15 | int length = *a ; 16 | int init = *b ; 17 | int n = init ; 18 | for (int i = 0; i < length; i++) { 19 | __VERIFIER_assert((init + i) == n) ; 20 | n++; 21 | } 22 | //for (int i = init ; i < length; i = i + 1) ; 23 | //__VERIFIER_assert(n == length) ; 24 | } 25 | 26 | void decr(int * a) { 27 | int length = *a ; 28 | //int n = 0 ; 29 | /* for (int i = length; i >= 0; i--) { 30 | __VERIFIER_assert(n == length - i) ; 31 | n++ ; 32 | } 33 | __VERIFIER_assert(n == length) ;*/ 34 | for (int i = 0 ; i >= length; i = i - 4) ; 35 | } 36 | 37 | void decr2(int * a, int * b) { 38 | int length = *a ; 39 | int init = * b ; 40 | //int n = 0 ; 41 | /* for (int i = length; i >= 0; i--) { 42 | __VERIFIER_assert(n == length - i) ; 43 | n++ ; 44 | } 45 | __VERIFIER_assert(n == length) ;*/ 46 | for (int i = init ; i >= length; i = i - 4) ; 47 | } 48 | 49 | void main() {} 50 | -------------------------------------------------------------------------------- /tests/types/counter_decr2_counter_types.cdump: -------------------------------------------------------------------------------- 1 | counter.c:38.14-16: `*a' -> [0..0x7FFFFFFF] 2 | counter.c:38.15-16: `a' -> {0} or ([1..0xFFFFFFFF] : (Name(nat))[{0}].0*) 3 | counter.c:39.12-15: `*b' -> [0..0x7FFFFFFF] 4 | counter.c:39.14-15: `b' -> {0} or ([1..0xFFFFFFFF] : (Name(nat))[{0}].0*) 5 | counter.c:46.14-18: `init' -> [0..0x7FFFFFFF] 6 | counter.c:46.21-32: `i >= length' -> {0; 1} 7 | counter.c:46.21-22: `i' -> [-4..0x7FFFFFFF] 8 | counter.c:46.26-32: `length' -> [0..0x7FFFFFFF] 9 | counter.c:46.38-43: `i - 4' -> [-4..0x7FFFFFFB] 10 | counter.c:46.38-39: `i' -> [0..0x7FFFFFFF] 11 | Unproved regular alarms: 12 | counter.c:38: Memory_access(*a, read) {true;false} 13 | counter.c:39: Memory_access(*b, read) {true;false} 14 | Unproved additional alarms: 15 | Proved 0/2 regular alarms 16 | Unproved 2 regular alarms and 0 additional alarms. 17 | Solved 0/0 user assertions, proved 0 18 | -------------------------------------------------------------------------------- /tests/types/counter_decr_counter_types.cdump: -------------------------------------------------------------------------------- 1 | counter.c:27.14-16: `*a' -> [0..0x7FFFFFFF] 2 | counter.c:27.15-16: `a' -> {0} or ([1..0xFFFFFFFF] : (Name(nat))[{0}].0*) 3 | counter.c:34.18-29: `i >= length' -> {0; 1} 4 | counter.c:34.18-19: `i' -> {-4; 0} 5 | counter.c:34.23-29: `length' -> [0..0x7FFFFFFF] 6 | counter.c:34.35-40: `i - 4' -> {-4} 7 | counter.c:34.35-36: `i' -> {0} 8 | Unproved regular alarms: 9 | counter.c:27: Memory_access(*a, read) {true;false} 10 | Unproved additional alarms: 11 | Proved 0/1 regular alarms 12 | Unproved 1 regular alarms and 0 additional alarms. 13 | Solved 0/0 user assertions, proved 0 14 | -------------------------------------------------------------------------------- /tests/types/counter_incr2_counter_types.cdump: -------------------------------------------------------------------------------- 1 | counter.c:15.14-16: `*a' -> [0..0x7FFFFFFF] 2 | counter.c:15.15-16: `a' -> {0} or ([1..0xFFFFFFFF] : (Name(nat))[{0}].0*) 3 | counter.c:16.12-14: `*b' -> [0..0x7FFFFFFF] 4 | counter.c:16.13-14: `b' -> {0} or ([1..0xFFFFFFFF] : (Name(nat))[{0}].0*) 5 | counter.c:17.9-13: `init' -> [0..0x7FFFFFFF] 6 | counter.c:18.17-27: `i < length' -> {0; 1} 7 | counter.c:18.17-18: `i' -> [0..0x7FFFFFFF] 8 | counter.c:18.21-27: `length' -> [0..0x7FFFFFFF] 9 | counter.c:19.21-36: `init + i == n' -> {0; 1} 10 | counter.c:19.22-30: `init + i' -> [0..0x7FFFFFFF] 11 | counter.c:19.22-26: `init' -> [0..0x7FFFFFFF] 12 | counter.c:19.29-30: `i' -> [0..0x7FFFFFFE] 13 | counter.c:19.35-36: `n' -> [0..0x7FFFFFFF] 14 | counter.c:20.3-6: `n + 1' -> [1..0x7FFFFFFF] 15 | counter.c:20.3-4: `n' -> [0..0x7FFFFFFF] 16 | counter.c:18.29-32: `i + 1' -> [1..0x7FFFFFFF] 17 | counter.c:18.29-30: `i' -> [0..0x7FFFFFFE] 18 | Unproved regular alarms: 19 | counter.c:15: Memory_access(*a, read) {true;false} 20 | counter.c:16: Memory_access(*b, read) {true;false} 21 | Unproved additional alarms: 22 | Proved 0/2 regular alarms 23 | Unproved 2 regular alarms and 0 additional alarms. 24 | counter.c:19: assertion is TRUE (valid) (proved with smt solving) 25 | Solved 1/1 user assertions, proved 1 26 | -------------------------------------------------------------------------------- /tests/types/counter_incr_counter_types.cdump: -------------------------------------------------------------------------------- 1 | counter.c:4.14-16: `*a' -> [0..0x7FFFFFFF] 2 | counter.c:4.15-16: `a' -> {0} or ([1..0xFFFFFFFF] : (Name(nat))[{0}].0*) 3 | counter.c:6.17-27: `i < length' -> {0; 1} 4 | counter.c:6.17-18: `i' -> [0..0x7FFFFFFF] 5 | counter.c:6.21-27: `length' -> [0..0x7FFFFFFF] 6 | counter.c:7.21-27: `n == i' -> {0x1} 7 | counter.c:7.21-22: `n' -> [0..0x7FFFFFFE] 8 | counter.c:7.26-27: `i' -> [0..0x7FFFFFFE] 9 | counter.c:8.3-6: `n + 1' -> [1..0x7FFFFFFF] 10 | counter.c:8.3-4: `n' -> [0..0x7FFFFFFE] 11 | counter.c:6.29-32: `i + 1' -> [1..0x7FFFFFFF] 12 | counter.c:6.29-30: `i' -> [0..0x7FFFFFFE] 13 | Unproved regular alarms: 14 | counter.c:4: Memory_access(*a, read) {true;false} 15 | Unproved additional alarms: 16 | Proved 0/1 regular alarms 17 | Unproved 1 regular alarms and 0 additional alarms. 18 | counter.c:7: assertion is TRUE (valid) (proved with abstract interpretation) 19 | Solved 1/1 user assertions, proved 1 20 | -------------------------------------------------------------------------------- /tests/types/counter_types.c: -------------------------------------------------------------------------------- 1 | type nat = int with self >= 0 2 | 3 | void incr(nat * a); 4 | 5 | void incr2(nat * a, nat * b); 6 | 7 | void decr(nat * a); 8 | 9 | void decr2(nat * a, nat * b); 10 | -------------------------------------------------------------------------------- /tests/types/divide.c: -------------------------------------------------------------------------------- 1 | // 2 | 3 | void test(int * a, int * b) { 4 | int i = *a ; 5 | int j = *b ; 6 | //__VERIFIER_assert (j != 0) ; 7 | int c = i / j ; 8 | //__VERIFIER_assert (c) ; 9 | } 10 | 11 | void main(){} -------------------------------------------------------------------------------- /tests/types/divide_test_divide_types.cdump: -------------------------------------------------------------------------------- 1 | divide.c:4.10-12: `*a' -> [--..--] 2 | divide.c:4.11-12: `a' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 3 | divide.c:5.10-12: `*b' -> [1..0x7FFFFFFF] 4 | divide.c:5.11-12: `b' -> ([1..0xFFFFFFFF] : ({self : Name(pos)[{0}].(0)* | (self != 0)})) 5 | divide.c:7.10-15: `i / j' -> [--..--] 6 | divide.c:7.10-11: `i' -> [--..--] 7 | divide.c:7.14-15: `j' -> [1..0x7FFFFFFF] 8 | Unproved regular alarms: 9 | Unproved additional alarms: 10 | Proved 3/3 regular alarms 11 | Unproved 0 regular alarms and 0 additional alarms. 12 | Solved 0/0 user assertions, proved 0 13 | -------------------------------------------------------------------------------- /tests/types/divide_types.c: -------------------------------------------------------------------------------- 1 | type pos = int with self > 0 2 | 3 | void test(int+ a, pos+ b); 4 | 5 | -------------------------------------------------------------------------------- /tests/types/endian.c: -------------------------------------------------------------------------------- 1 | // 2 | 3 | struct pair { 4 | int x ; 5 | int y ; 6 | }; 7 | 8 | 9 | void test1(struct pair * p) 10 | { 11 | p->x = 3 ; 12 | p->y = 5 ; 13 | unsigned long * ptr = (unsigned long *) p ; 14 | __VERIFIER_assert(*ptr = 0x0000000500000003) ; 15 | } 16 | 17 | void test1_inverted(struct pair * p) 18 | { 19 | p->x = 5 ; 20 | p->y = 3 ; 21 | unsigned long * ptr = (unsigned long *) p ; 22 | __VERIFIER_assert(*ptr = 0x0000000300000005) ; 23 | } 24 | 25 | void test2(struct pair * p) 26 | { 27 | unsigned long * ptr = (unsigned long *) p ; 28 | __VERIFIER_assert(*ptr = 0x0000000500000003) ; 29 | } 30 | 31 | void test3(struct pair * p) 32 | { 33 | p->x = 3 ; 34 | p->y = 5 ; 35 | unsigned int * ptr = (unsigned int *) p ; 36 | __VERIFIER_assert(*ptr = 0x00000003) ; 37 | } 38 | 39 | void test4(struct pair * p) 40 | { 41 | p->x = 3 ; 42 | p->y = 5 ; 43 | unsigned int * ptr = (unsigned int *) p ; 44 | __VERIFIER_assert(*(ptr+1) = 0x00000005) ; 45 | } 46 | 47 | void test5() 48 | { 49 | struct pair p ; 50 | p.x = 3 ; 51 | p.y = 5 ; 52 | unsigned long * ptr = (unsigned long *) &p ; 53 | __VERIFIER_assert(*ptr = 0x0000000500000003) ; 54 | } 55 | 56 | void main() {} 57 | -------------------------------------------------------------------------------- /tests/types/endian_test1_endian_types.cdump: -------------------------------------------------------------------------------- 1 | endian.c:11.4-5: `p' -> {0} or ([1..0xFFFFFFFF] : (Name(struct pair))[{0}].0*) 2 | endian.c:12.4-5: `p' -> ([1..0xFFFFFFFF] : (Name(struct pair))[{0}].0*) 3 | endian.c:13.44-45: `(unsigned long *)p' -> ([1..0xFFFFFFFB] : (Name(struct pair))[{0}].0*) 4 | endian.c:13.44-45: `p' -> ([1..0xFFFFFFFB] : (Name(struct pair))[{0}].0*) 5 | endian.c:14.23-26: `ptr' -> ([1..0xFFFFFFFB] : (Name(struct pair))[{0}].0*) 6 | endian.c:14.22-26: `tmp' -> {3} 7 | endian.c:14.22-47: `tmp' -> {3} 8 | Unproved regular alarms: 9 | endian.c:11: Memory_access(p->x, write) {true;false} 10 | Unproved additional alarms: 11 | Proved 2/3 regular alarms 12 | Unproved 1 regular alarms and 0 additional alarms. 13 | endian.c:14: assertion is TRUE (valid) (proved with abstract interpretation) 14 | Solved 1/1 user assertions, proved 1 15 | -------------------------------------------------------------------------------- /tests/types/endian_test1_inverted_endian_types.cdump: -------------------------------------------------------------------------------- 1 | endian.c:19.4-5: `p' -> {0} or ([1..0xFFFFFFFF] : (Name(struct pair))[{0}].0*) 2 | endian.c:20.4-5: `p' -> ([1..0xFFFFFFFF] : (Name(struct pair))[{0}].0*) 3 | endian.c:21.44-45: `(unsigned long *)p' -> ([1..0xFFFFFFFB] : (Name(struct pair))[{0}].0*) 4 | endian.c:21.44-45: `p' -> ([1..0xFFFFFFFB] : (Name(struct pair))[{0}].0*) 5 | endian.c:22.23-26: `ptr' -> ([1..0xFFFFFFFB] : (Name(struct pair))[{0}].0*) 6 | endian.c:22.22-26: `tmp' -> {5} 7 | endian.c:22.22-47: `tmp' -> {5} 8 | Unproved regular alarms: 9 | endian.c:19: Memory_access(p->x, write) {true;false} 10 | Unproved additional alarms: 11 | Proved 2/3 regular alarms 12 | Unproved 1 regular alarms and 0 additional alarms. 13 | endian.c:22: assertion is TRUE (valid) (proved with abstract interpretation) 14 | Solved 1/1 user assertions, proved 1 15 | -------------------------------------------------------------------------------- /tests/types/endian_test2_endian_types.cdump: -------------------------------------------------------------------------------- 1 | endian.c:27.44-45: `(unsigned long *)p' -> {0} or ([1..0xFFFFFFFF] : (Name(struct pair))[{0}].0*) 2 | endian.c:27.44-45: `p' -> {0} or ([1..0xFFFFFFFF] : (Name(struct pair))[{0}].0*) 3 | endian.c:28.23-26: `ptr' -> {0} or ([1..0xFFFFFFFF] : (Name(struct pair))[{0}].0*) 4 | endian.c:28.22-26: `tmp' -> {3} 5 | endian.c:28.22-47: `tmp' -> {3} 6 | Unproved regular alarms: 7 | endian.c:28: Memory_access(*ptr, write) {true;false} 8 | Unproved additional alarms: 9 | Proved 0/1 regular alarms 10 | Unproved 1 regular alarms and 0 additional alarms. 11 | endian.c:28: assertion is TRUE (valid) (proved with abstract interpretation) 12 | Solved 1/1 user assertions, proved 1 13 | -------------------------------------------------------------------------------- /tests/types/endian_test3_endian_types.cdump: -------------------------------------------------------------------------------- 1 | endian.c:33.4-5: `p' -> {0} or ([1..0xFFFFFFFF] : (Name(struct pair))[{0}].0*) 2 | endian.c:34.4-5: `p' -> ([1..0xFFFFFFFF] : (Name(struct pair))[{0}].0*) 3 | endian.c:35.42-43: `(unsigned int *)p' -> ([1..0xFFFFFFFB] : (Name(struct pair))[{0}].0*) 4 | endian.c:35.42-43: `p' -> ([1..0xFFFFFFFB] : (Name(struct pair))[{0}].0*) 5 | endian.c:36.23-26: `ptr' -> ([1..0xFFFFFFFB] : (Name(struct pair))[{0}].0*) 6 | endian.c:36.22-26: `tmp' -> {3} 7 | endian.c:36.22-39: `tmp' -> {3} 8 | Unproved regular alarms: 9 | endian.c:33: Memory_access(p->x, write) {true;false} 10 | Unproved additional alarms: 11 | Proved 2/3 regular alarms 12 | Unproved 1 regular alarms and 0 additional alarms. 13 | endian.c:36: assertion is TRUE (valid) (proved with abstract interpretation) 14 | Solved 1/1 user assertions, proved 1 15 | -------------------------------------------------------------------------------- /tests/types/endian_test4_endian_types.cdump: -------------------------------------------------------------------------------- 1 | endian.c:41.4-5: `p' -> {0} or ([1..0xFFFFFFFF] : (Name(struct pair))[{0}].0*) 2 | endian.c:42.4-5: `p' -> ([1..0xFFFFFFFF] : (Name(struct pair))[{0}].0*) 3 | endian.c:43.42-43: `(unsigned int *)p' -> ([1..0xFFFFFFFB] : (Name(struct pair))[{0}].0*) 4 | endian.c:43.42-43: `p' -> ([1..0xFFFFFFFB] : (Name(struct pair))[{0}].0*) 5 | endian.c:44.24-29: `ptr + 1' -> ([1..0xFFFFFFFB] : (Name(struct pair))[{0}].0*) + 0x4 6 | endian.c:44.24-27: `ptr' -> ([1..0xFFFFFFFB] : (Name(struct pair))[{0}].0*) 7 | endian.c:44.22-30: `tmp' -> {5} 8 | endian.c:44.22-43: `tmp' -> {5} 9 | Unproved regular alarms: 10 | endian.c:41: Memory_access(p->x, write) {true;false} 11 | Unproved additional alarms: 12 | Proved 2/3 regular alarms 13 | Unproved 1 regular alarms and 0 additional alarms. 14 | endian.c:44: assertion is TRUE (valid) (proved with abstract interpretation) 15 | Solved 1/1 user assertions, proved 1 16 | -------------------------------------------------------------------------------- /tests/types/endian_test5_endian_types.cdump: -------------------------------------------------------------------------------- 1 | endian.c:52.44-46: `(unsigned long *)(& p)' -> {{ &p }} 2 | endian.c:53.23-26: `ptr' -> {{ &p }} 3 | endian.c:53.22-26: `tmp' -> {3} 4 | endian.c:53.22-47: `tmp' -> {3} 5 | Unproved regular alarms: 6 | Unproved additional alarms: 7 | Proved 3/3 regular alarms 8 | Unproved 0 regular alarms and 0 additional alarms. 9 | endian.c:53: assertion is TRUE (valid) (proved with abstract interpretation) 10 | Solved 1/1 user assertions, proved 1 11 | -------------------------------------------------------------------------------- /tests/types/endian_types.c: -------------------------------------------------------------------------------- 1 | struct pair { 2 | int x ; 3 | int y ; 4 | }; 5 | 6 | void test1(struct pair * p); 7 | 8 | void test1_inverted(struct pair * p); 9 | 10 | void test2(struct pair * p); 11 | 12 | void test3(struct pair * p); 13 | 14 | void test4(struct pair * p); 15 | 16 | void test5(); 17 | -------------------------------------------------------------------------------- /tests/types/exists_fun.c: -------------------------------------------------------------------------------- 1 | void test(int a, int b) { 2 | __VERIFIER_assert (a == b) ; 3 | } 4 | 5 | int main() { 6 | return 0; 7 | } -------------------------------------------------------------------------------- /tests/types/exists_fun_test_exists_fun_types.cdump: -------------------------------------------------------------------------------- 1 | exists_fun.c:2.21-27: `a == b' -> {0x1} 2 | exists_fun.c:2.21-22: `a' -> [--..--] 3 | exists_fun.c:2.26-27: `b' -> [--..--] 4 | Unproved regular alarms: 5 | Unproved additional alarms: 6 | Proved 0/0 regular alarms 7 | Unproved 0 regular alarms and 0 additional alarms. 8 | exists_fun.c:2: assertion is TRUE (valid) (proved with abstract interpretation) 9 | Solved 1/1 user assertions, proved 1 10 | -------------------------------------------------------------------------------- /tests/types/exists_fun_types.c: -------------------------------------------------------------------------------- 1 | ∃ n : int. (void test((int with self = n) a, (int with self = n) b)); 2 | -------------------------------------------------------------------------------- /tests/types/flexible.c: -------------------------------------------------------------------------------- 1 | // 2 | 3 | struct vectord { 4 | int len; //short len ; // Solve padding problems // there must be at least one other data member 5 | int arr[]; // the flexible array member must be last 6 | }; 7 | 8 | void read(struct vectord *p, int * res, int i) { 9 | if (0 <= i && i < p->len) { 10 | *res = p->arr[i] ; 11 | } 12 | __VERIFIER_flush_cache() ; 13 | } 14 | 15 | void read_wrong(struct vectord *p, int * res, int i) { 16 | if (0 <= i) { 17 | *res = p->arr[i] ; 18 | } 19 | __VERIFIER_flush_cache() ; 20 | } 21 | 22 | 23 | void write(struct vectord *p, int i, int v) { 24 | if (0 <= i && i < p->len) { 25 | p->arr[i] = v ; 26 | } 27 | __VERIFIER_flush_cache() ; 28 | } 29 | 30 | void iter(struct vectord *p, int * res) { 31 | for (int i = 0; i < p->len; i++) { 32 | *res = p->arr[i] ; 33 | p->arr[i] = 0 ; 34 | } 35 | __VERIFIER_flush_cache() ; 36 | } 37 | 38 | void main() {} 39 | -------------------------------------------------------------------------------- /tests/types/flexible_iter_flexible_types.cdump: -------------------------------------------------------------------------------- 1 | flexible.c:31.18-28: `i < p->len' -> {0; 1} 2 | flexible.c:31.18-19: `i' -> [0..0x7FFFFFFF] 3 | flexible.c:31.22-28: `p->len' -> [1..0x7FFFFFFF] 4 | flexible.c:31.22-23: `p' -> ([1..0xFFFFFFFF] : ({self : vector("#1")[{0}].(0)* | (self != 0)})) 5 | flexible.c:32.5-8: `res' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 6 | flexible.c:32.11-20: `p->arr[i]' -> [--..--] 7 | flexible.c:32.11-12: `p' -> ([1..0xFFFFFFFF] : ({self : vector("#1")[{0}].(0)* | (self != 0)})) 8 | flexible.c:32.18-19: `i' -> [0..0x7FFFFFFE] 9 | flexible.c:33.3-4: `p' -> ([1..0xFFFFFFFB] : ({self : vector("#1")[{0}].(0)* | (self != 0)})) 10 | flexible.c:33.10-11: `i' -> [0..0x7FFFFFFE] 11 | flexible.c:31.30-33: `i + 1' -> [1..0x7FFFFFFF] 12 | flexible.c:31.30-31: `i' -> [0..0x7FFFFFFE] 13 | Unproved regular alarms: 14 | Unproved additional alarms: 15 | Proved 4/4 regular alarms 16 | Unproved 0 regular alarms and 0 additional alarms. 17 | Solved 0/0 user assertions, proved 0 18 | -------------------------------------------------------------------------------- /tests/types/flexible_read_flexible_types.cdump: -------------------------------------------------------------------------------- 1 | flexible.c:9.6-12: `0 <= i' -> {0x1} 2 | flexible.c:9.11-12: `i' -> [0..0x7FFFFFFF] 3 | flexible.c:9.16-26: `i < p->len' -> {0; 1} 4 | flexible.c:9.16-17: `i' -> [0..0x7FFFFFFF] 5 | flexible.c:9.20-26: `p->len' -> [1..0x7FFFFFFF] 6 | flexible.c:9.20-21: `p' -> ([1..0xFFFFFFFF] : ({self : vector("#1")[{0}].(0)* | (self != 0)})) 7 | flexible.c:10.5-8: `res' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 8 | flexible.c:10.11-20: `p->arr[i]' -> [--..--] 9 | flexible.c:10.11-12: `p' -> ([1..0xFFFFFFFF] : ({self : vector("#1")[{0}].(0)* | (self != 0)})) 10 | flexible.c:10.18-19: `i' -> [0..0x7FFFFFFE] 11 | Unproved regular alarms: 12 | Unproved additional alarms: 13 | Proved 3/3 regular alarms 14 | Unproved 0 regular alarms and 0 additional alarms. 15 | Solved 0/0 user assertions, proved 0 16 | -------------------------------------------------------------------------------- /tests/types/flexible_read_wrong_flexible_types.cdump: -------------------------------------------------------------------------------- 1 | flexible.c:16.6-12: `0 <= i' -> {0x1} 2 | flexible.c:16.11-12: `i' -> [0..0x7FFFFFFF] 3 | flexible.c:17.5-8: `res' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 4 | flexible.c:17.11-20: `p->arr[i]' -> [--..--] 5 | flexible.c:17.11-12: `p' -> ([1..0xFFFFFFFF] : ({self : vector("#1")[{0}].(0)* | (self != 0)})) 6 | flexible.c:17.18-19: `i' -> [0..0x7FFFFFFF] 7 | Unproved regular alarms: 8 | Unproved additional alarms: 9 | + flexible.c:17 : { *res = p->arr[i]; } -> array_offset_access ; 10 | Proved 2/2 regular alarms 11 | Unproved 0 regular alarms and 1 additional alarms. 12 | Solved 0/0 user assertions, proved 0 13 | -------------------------------------------------------------------------------- /tests/types/flexible_types.c: -------------------------------------------------------------------------------- 1 | type nat = int with self >= 0 2 | type pos = int with self > 0 3 | 4 | /* type vector = ∃ l: (int with self > 0). struct { 5 | (int with self = l) len; 6 | int[l] arr; 7 | } */ 8 | 9 | type vector(sz) = struct { 10 | (int with self = sz) len ; 11 | int[sz] arr; 12 | } 13 | 14 | type vectorptr = ∃ l: pos. (vector(l)+) 15 | 16 | /* void read(vector+ p, int+ res, nat i); */ 17 | /* void read(vectorptr p, int+ res, int i); */ 18 | void read(vectorptr p, int+ res, nat i); 19 | 20 | void read_wrong(vectorptr p, int+ res, nat i); 21 | 22 | /* void write(vector+ p, nat i, int v); */ 23 | void write(vectorptr p, nat i, int v); 24 | 25 | /* void iter(vector+ p, int+ res); */ 26 | void iter(vectorptr p, int+ res); 27 | -------------------------------------------------------------------------------- /tests/types/flexible_write_flexible_types.cdump: -------------------------------------------------------------------------------- 1 | flexible.c:24.6-12: `0 <= i' -> {0x1} 2 | flexible.c:24.11-12: `i' -> [0..0x7FFFFFFF] 3 | flexible.c:24.16-26: `i < p->len' -> {0; 1} 4 | flexible.c:24.16-17: `i' -> [0..0x7FFFFFFF] 5 | flexible.c:24.20-26: `p->len' -> [1..0x7FFFFFFF] 6 | flexible.c:24.20-21: `p' -> ([1..0xFFFFFFFF] : ({self : vector("#1")[{0}].(0)* | (self != 0)})) 7 | flexible.c:25.4-5: `p' -> ([1..0xFFFFFFFF] : ({self : vector("#1")[{0}].(0)* | (self != 0)})) 8 | flexible.c:25.11-12: `i' -> [0..0x7FFFFFFE] 9 | flexible.c:25.16-17: `v' -> [--..--] 10 | Unproved regular alarms: 11 | Unproved additional alarms: 12 | Proved 2/2 regular alarms 13 | Unproved 0 regular alarms and 0 additional alarms. 14 | Solved 0/0 user assertions, proved 0 15 | -------------------------------------------------------------------------------- /tests/types/fun_ptr.c: -------------------------------------------------------------------------------- 1 | #include 2 | // A normal function with an int parameter 3 | // and void return type 4 | void fun(int a) 5 | { 6 | printf("Value of a is %d\n", a); 7 | } 8 | 9 | int fun2(int a) { return a * 2; } 10 | 11 | int fun3(int a) { return a * 4; } 12 | 13 | void test1() 14 | { 15 | void (*funptr)(int) = &fun; 16 | (*funptr)(10); 17 | } 18 | 19 | void test2(void (*funptr)(int)) { 20 | printf("starting fun ptr test\n"); 21 | (*funptr)(10) ; 22 | printf("ending fun ptr test\n"); 23 | } 24 | 25 | void test3(void (*funptr)(int)) { 26 | printf("starting fun ptr test\n"); 27 | funptr(10) ; 28 | printf("ending fun ptr test\n"); 29 | } 30 | 31 | void test4() { 32 | void (*funptr)(int) = &fun; 33 | funptr(10); 34 | } 35 | 36 | void test5() { 37 | void (*funptr)(int) = fun; 38 | (*funptr)(10); 39 | } 40 | 41 | //int test6() { return 6 ; } 42 | 43 | int test6() { 44 | int (*funptr)(int) = fun2; 45 | return ((*funptr)(10) + 5) ; 46 | } 47 | 48 | int test7(int (*funptr)(int)) { 49 | return (*funptr)(10) + 5 ; 50 | } 51 | 52 | void test8() 53 | { 54 | void (*funptr)(int) = &fun; 55 | //(*funptr)(10); 56 | test2(&fun) ; 57 | } 58 | 59 | void test9() 60 | { 61 | void (*funptr)(int) = &fun; 62 | test2(*funptr) ; 63 | } 64 | 65 | void main() {} 66 | 67 | -------------------------------------------------------------------------------- /tests/types/fun_ptr_test1_fun_ptr_types.cdump: -------------------------------------------------------------------------------- 1 | fun_ptr.c:6.33-34: `a' -> {10} 2 | fun_ptr.c:16.6-12: `funptr' -> ([--..--] -> &fun} 3 | Unproved regular alarms: 4 | Unproved additional alarms: 5 | Proved 0/0 regular alarms 6 | Unproved 0 regular alarms and 0 additional alarms. 7 | Solved 0/0 user assertions, proved 0 8 | -------------------------------------------------------------------------------- /tests/types/fun_ptr_test2_fun_ptr_types.cdump: -------------------------------------------------------------------------------- 1 | fun_ptr.c:21.6-12: `funptr' -> ([1..0xFFFFFFFF] : 2 | ({self : Function (void, [int(4)])[{0}].(0)* | (self != 0)})) 3 | Unproved regular alarms: 4 | Unproved additional alarms: 5 | Proved 0/0 regular alarms 6 | Unproved 0 regular alarms and 0 additional alarms. 7 | Solved 0/0 user assertions, proved 0 8 | -------------------------------------------------------------------------------- /tests/types/fun_ptr_test3_fun_ptr_types.cdump: -------------------------------------------------------------------------------- 1 | fun_ptr.c:27.4-10: `funptr' -> ([1..0xFFFFFFFF] : 2 | ({self : Function (void, [int(4)])[{0}].(0)* | (self != 0)})) 3 | Unproved regular alarms: 4 | Unproved additional alarms: 5 | Proved 0/0 regular alarms 6 | Unproved 0 regular alarms and 0 additional alarms. 7 | Solved 0/0 user assertions, proved 0 8 | -------------------------------------------------------------------------------- /tests/types/fun_ptr_test4_fun_ptr_types.cdump: -------------------------------------------------------------------------------- 1 | fun_ptr.c:6.33-34: `a' -> {10} 2 | fun_ptr.c:33.4-10: `funptr' -> ([--..--] -> &fun} 3 | Unproved regular alarms: 4 | Unproved additional alarms: 5 | Proved 0/0 regular alarms 6 | Unproved 0 regular alarms and 0 additional alarms. 7 | Solved 0/0 user assertions, proved 0 8 | -------------------------------------------------------------------------------- /tests/types/fun_ptr_test5_fun_ptr_types.cdump: -------------------------------------------------------------------------------- 1 | fun_ptr.c:6.33-34: `a' -> {10} 2 | fun_ptr.c:38.6-12: `funptr' -> ([--..--] -> &fun} 3 | Unproved regular alarms: 4 | Unproved additional alarms: 5 | Proved 0/0 regular alarms 6 | Unproved 0 regular alarms and 0 additional alarms. 7 | Solved 0/0 user assertions, proved 0 8 | -------------------------------------------------------------------------------- /tests/types/fun_ptr_test6_fun_ptr_types.cdump: -------------------------------------------------------------------------------- 1 | fun_ptr.c:9.25-30: `a * 2' -> {20} 2 | fun_ptr.c:9.25-26: `a' -> {10} 3 | fun_ptr.c:9.18-31: `__retres' -> {20} 4 | fun_ptr.c:45.14-20: `funptr' -> ([--..--] -> &fun2} 5 | fun_ptr.c:45.12-29: `tmp + 5' -> {25} 6 | fun_ptr.c:45.12-25: `tmp' -> {20} 7 | fun_ptr.c:45.4-32: `__retres' -> {25} 8 | Unproved regular alarms: 9 | Unproved additional alarms: 10 | Proved 0/0 regular alarms 11 | Unproved 0 regular alarms and 0 additional alarms. 12 | Solved 0/0 user assertions, proved 0 13 | -------------------------------------------------------------------------------- /tests/types/fun_ptr_test8_fun_ptr_types.cdump: -------------------------------------------------------------------------------- 1 | Unproved regular alarms: 2 | Unproved additional alarms: 3 | + fun_ptr.c:56 : { test2(& fun); } -> typing_store ; 4 | Proved 0/0 regular alarms 5 | Unproved 0 regular alarms and 1 additional alarms. 6 | Solved 0/0 user assertions, proved 0 7 | -------------------------------------------------------------------------------- /tests/types/fun_ptr_test9_fun_ptr_types.cdump: -------------------------------------------------------------------------------- 1 | fun_ptr.c:62.11-17: `funptr' -> ([--..--] -> &fun} 2 | Unproved regular alarms: 3 | Unproved additional alarms: 4 | + fun_ptr.c:62 : { test2(funptr); } -> typing_store ; 5 | Proved 0/0 regular alarms 6 | Unproved 0 regular alarms and 1 additional alarms. 7 | Solved 0/0 user assertions, proved 0 8 | -------------------------------------------------------------------------------- /tests/types/fun_ptr_types.c: -------------------------------------------------------------------------------- 1 | inline void fun(int a) ; 2 | inline int fun2(int a) ; 3 | 4 | int fun3(int a); 5 | 6 | void test1 () ; 7 | void test2 (([int] -> void) + funptr); 8 | void test3 (([int] -> void) + funptr); 9 | void test4 (); 10 | void test5 (); 11 | int test6 () ; 12 | int test7 (([int] -> int) + funptr); 13 | void test8 () ; 14 | void test9 () ; 15 | -------------------------------------------------------------------------------- /tests/types/global.c: -------------------------------------------------------------------------------- 1 | // Test: 2 | int glob; 3 | 4 | 5 | int test(int arg){ 6 | int j = glob + 1; 7 | return j; 8 | } 9 | 10 | void main() {} 11 | -------------------------------------------------------------------------------- /tests/types/global_test_global_types.cdump: -------------------------------------------------------------------------------- 1 | global.c:6.10-18: `glob + 1' -> [6..0x7FFFFFFF] 2 | global.c:6.10-14: `glob' -> [5..0x7FFFFFFF] 3 | global.c:7.9-10: `j' -> [6..0x7FFFFFFF] 4 | Unproved regular alarms: 5 | Unproved additional alarms: 6 | Proved 0/0 regular alarms 7 | Unproved 0 regular alarms and 0 additional alarms. 8 | Solved 0/0 user assertions, proved 0 9 | -------------------------------------------------------------------------------- /tests/types/global_types.c: -------------------------------------------------------------------------------- 1 | (int with self >= 5) glob; 2 | 3 | int test(int arg) ; 4 | 5 | -------------------------------------------------------------------------------- /tests/types/infinite_loop.c: -------------------------------------------------------------------------------- 1 | // This could trigger an infinite loop in codex because the initial loop step 2 | // was refined during the loop: 3 | // 4 | // The access to f->elt tells us that the numeric value of f must be smaller 5 | // than MAX_INT - offset_of(elt),. 6 | 7 | struct intlist { 8 | struct intlist *next; 9 | int elt; 10 | }; 11 | 12 | void main(struct intlist *f) { 13 | int x; 14 | while (f->elt) { 15 | f = f->next; 16 | // x = f->elt; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/types/infinite_loop_main_infinite_loop_types.cdump: -------------------------------------------------------------------------------- 1 | infinite_loop.c:14.9-15: `f->elt' -> [--..--] 2 | infinite_loop.c:14.9-10: `f' -> ([1..0xFFFFFFFF] : ({self : Name(struct intlist)[{0}].(0)* | (self != 0)})) 3 | infinite_loop.c:15.8-15: `f->next' -> ([1..0xFFFFFFFF] : ({self : Name(struct intlist)[{0}].(0)* | (self != 0)})) 4 | infinite_loop.c:15.8-9: `f' -> ([1..0xFFFFFFFB] : ({self : Name(struct intlist)[{0}].(0)* | (self != 0)})) 5 | Unproved regular alarms: 6 | Unproved additional alarms: 7 | Proved 2/2 regular alarms 8 | Unproved 0 regular alarms and 0 additional alarms. 9 | Solved 0/0 user assertions, proved 0 10 | -------------------------------------------------------------------------------- /tests/types/infinite_loop_types.c: -------------------------------------------------------------------------------- 1 | struct intlist { 2 | struct intlist + next; 3 | int elt; 4 | }; 5 | 6 | void main(struct intlist + elm); 7 | -------------------------------------------------------------------------------- /tests/types/list_same.c: -------------------------------------------------------------------------------- 1 | struct alist { 2 | int data; 3 | struct alist* next; 4 | }; 5 | 6 | void list_iter(struct alist * lst, int * a) { 7 | while (lst != 0) { 8 | *a = lst->data ; 9 | lst = lst->next ; 10 | } 11 | } 12 | 13 | void list_iter_check(struct alist * lst, int * a) { 14 | while (lst != 0) { 15 | __VERIFIER_assert(*a == lst->data) ; 16 | *a = lst->data ; 17 | lst = lst->next ; 18 | } 19 | } 20 | 21 | void main() {} 22 | -------------------------------------------------------------------------------- /tests/types/list_same_list_iter_check_list_same_types.cdump: -------------------------------------------------------------------------------- 1 | list_same.c:14.9-17: `lst != (struct alist *)0' -> {0; 1} 2 | list_same.c:14.9-12: `lst' -> {0} or ([1..0xFFFFFFFF] : (Name(struct alist))[{0}].0*) 3 | list_same.c:15.22-37: `*a == lst->data' -> {0; 1} 4 | list_same.c:15.22-24: `*a' -> [--..--] 5 | list_same.c:15.23-24: `a' -> {0} or ([1..0xFFFFFFFF] : (int(4))[{0}].0*) 6 | list_same.c:15.28-37: `lst->data' -> [--..--] 7 | list_same.c:15.28-31: `lst' -> ([1..0xFFFFFFFF] : (Name(struct alist))[{0}].0*) 8 | list_same.c:16.5-6: `a' -> ([1..0xFFFFFFFF] : (int(4))[{0}].0*) 9 | list_same.c:16.9-18: `lst->data' -> [--..--] 10 | list_same.c:16.9-12: `lst' -> ([1..0xFFFFFFFF] : (Name(struct alist))[{0}].0*) 11 | list_same.c:17.10-19: `lst->next' -> {0} or ([1..0xFFFFFFFF] : (Name(struct alist))[{0}].0*) 12 | list_same.c:17.10-13: `lst' -> ([1..0xFFFFFFFF] : (Name(struct alist))[{0}].0*) 13 | Unproved regular alarms: 14 | list_same.c:15: Memory_access(*a, read) {true;false} 15 | Unproved additional alarms: 16 | Proved 4/5 regular alarms 17 | Unproved 1 regular alarms and 0 additional alarms. 18 | list_same.c:15: assertion is FALSE (counter-example exists) (proved with smt solving) 19 | Solved 1/1 user assertions, proved 0 20 | -------------------------------------------------------------------------------- /tests/types/list_same_list_iter_list_same_types.cdump: -------------------------------------------------------------------------------- 1 | list_same.c:7.9-17: `lst != (struct alist *)0' -> {0; 1} 2 | list_same.c:7.9-12: `lst' -> {0} or ([1..0xFFFFFFFF] : (Name(struct alist))[{0}].0*) 3 | list_same.c:8.5-6: `a' -> {0} or ([1..0xFFFFFFFF] : (int(4))[{0}].0*) 4 | list_same.c:8.9-18: `lst->data' -> [--..--] 5 | list_same.c:8.9-12: `lst' -> ([1..0xFFFFFFFF] : (Name(struct alist))[{0}].0*) 6 | list_same.c:9.10-19: `lst->next' -> {0} or ([1..0xFFFFFFFF] : (Name(struct alist))[{0}].0*) 7 | list_same.c:9.10-13: `lst' -> ([1..0xFFFFFFFF] : (Name(struct alist))[{0}].0*) 8 | Unproved regular alarms: 9 | list_same.c:8: Memory_access(*a, write) {true;false} 10 | Unproved additional alarms: 11 | Proved 2/3 regular alarms 12 | Unproved 1 regular alarms and 0 additional alarms. 13 | Solved 0/0 user assertions, proved 0 14 | -------------------------------------------------------------------------------- /tests/types/list_same_types.c: -------------------------------------------------------------------------------- 1 | struct alist { 2 | int data; 3 | struct alist* next; 4 | }; 5 | 6 | void list_iter(struct alist * lst, int * a); 7 | void list_iter_check(struct alist * lst, int * a); 8 | -------------------------------------------------------------------------------- /tests/types/load.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | void test(int * a, int * b) { 4 | int c = *a ; 5 | int d = *b ; 6 | __VERIFIER_assert(c == d) ; 7 | __VERIFIER_flush_cache() ; 8 | } 9 | 10 | void test2(void** a) { 11 | int c = *a ; 12 | int d = *a ; 13 | __VERIFIER_assert(c == d) ; 14 | __VERIFIER_flush_cache() ; 15 | } 16 | 17 | void main(){} 18 | 19 | -------------------------------------------------------------------------------- /tests/types/load_test2_load_types.cdump: -------------------------------------------------------------------------------- 1 | load.c:11.9-11: `(int)*a' -> [--..--] 2 | load.c:11.9-11: `*a' -> [--..--] 3 | load.c:11.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 4 | load.c:12.9-11: `(int)*a' -> [--..--] 5 | load.c:12.9-11: `*a' -> [--..--] 6 | load.c:12.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 7 | load.c:13.19-25: `c == d' -> {0x1} 8 | load.c:13.19-20: `c' -> [--..--] 9 | load.c:13.24-25: `d' -> [--..--] 10 | Unproved regular alarms: 11 | Unproved additional alarms: 12 | Proved 2/2 regular alarms 13 | Unproved 0 regular alarms and 0 additional alarms. 14 | load.c:13: assertion is TRUE (valid) (proved with abstract interpretation) 15 | Solved 1/1 user assertions, proved 1 16 | -------------------------------------------------------------------------------- /tests/types/load_test_load_types.cdump: -------------------------------------------------------------------------------- 1 | load.c:4.10-12: `*a' -> [--..--] 2 | load.c:4.11-12: `a' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 3 | load.c:5.10-12: `*b' -> [--..--] 4 | load.c:5.11-12: `b' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 5 | load.c:6.20-26: `c == d' -> {0; 1} 6 | load.c:6.20-21: `c' -> [--..--] 7 | load.c:6.25-26: `d' -> [--..--] 8 | Unproved regular alarms: 9 | Unproved additional alarms: 10 | Proved 2/2 regular alarms 11 | Unproved 0 regular alarms and 0 additional alarms. 12 | load.c:6: assertion is FALSE (counter-example exists) (proved with smt solving) 13 | Solved 1/1 user assertions, proved 0 14 | -------------------------------------------------------------------------------- /tests/types/load_types.c: -------------------------------------------------------------------------------- 1 | void test(int+ ptr1, int+ ptr2); 2 | 3 | void test2(int+ ptr1); 4 | -------------------------------------------------------------------------------- /tests/types/nested_loop.c: -------------------------------------------------------------------------------- 1 | // 2 | 3 | // Only checks that the programs terminates 4 | void test(int * a) { 5 | int n = *a ; 6 | for (int i=0; i [--..--] 2 | nested_loop.c:5.10-11: `a' -> {0} or ([1..0xFFFFFFFF] : (int(4))[{0}].0*) 3 | nested_loop.c:6.15-18: `i < n' -> {0; 1} 4 | nested_loop.c:6.15-16: `i' -> [0..0x7FFFFFFF] 5 | nested_loop.c:6.17-18: `n' -> [--..--] 6 | nested_loop.c:7.16-19: `j < n' -> {0; 1} 7 | nested_loop.c:7.16-17: `j' -> [0..0x7FFFFFFF] 8 | nested_loop.c:7.18-19: `n' -> [1..0x7FFFFFFF] 9 | nested_loop.c:7.21-24: `j + 1' -> [1..0x7FFFFFFF] 10 | nested_loop.c:7.21-22: `j' -> [0..0x7FFFFFFE] 11 | nested_loop.c:6.20-23: `i + 1' -> [1..0x7FFFFFFF] 12 | nested_loop.c:6.20-21: `i' -> [0..0x7FFFFFFE] 13 | nested_loop.c:11.15-18: `i_0 < n' -> {0; 1} 14 | nested_loop.c:11.15-16: `i_0' -> [0..0x7FFFFFFF] 15 | nested_loop.c:11.17-18: `n' -> [--..--] 16 | nested_loop.c:11.20-23: `i_0 + 1' -> [1..0x7FFFFFFF] 17 | nested_loop.c:11.20-21: `i_0' -> [0..0x7FFFFFFE] 18 | Unproved regular alarms: 19 | nested_loop.c:5: Memory_access(*a, read) {true;false} 20 | Unproved additional alarms: 21 | Proved 0/1 regular alarms 22 | Unproved 1 regular alarms and 0 additional alarms. 23 | Solved 0/0 user assertions, proved 0 24 | -------------------------------------------------------------------------------- /tests/types/nested_loop_types.c: -------------------------------------------------------------------------------- 1 | void tst(int+ a); 2 | -------------------------------------------------------------------------------- /tests/types/null_ptr.c: -------------------------------------------------------------------------------- 1 | struct pair { 2 | int i; 3 | int j; 4 | }; 5 | 6 | 7 | void test(struct pair* p){ 8 | int a = p->i + p -> j; 9 | a = a+1; 10 | __VERIFIER_assert(((p->i + p->j) + 1) == a); 11 | } 12 | 13 | void main(){} 14 | -------------------------------------------------------------------------------- /tests/types/null_ptr_test_null_ptr_types.cdump: -------------------------------------------------------------------------------- 1 | null_ptr.c:8.10-23: `p->i + p->j' -> [--..--] 2 | null_ptr.c:8.10-14: `p->i' -> [--..--] 3 | null_ptr.c:8.10-11: `p' -> {0} or ([1..0xFFFFFFFF] : (Name(struct pair))[{0}].0*) 4 | null_ptr.c:8.17-23: `p->j' -> [--..--] 5 | null_ptr.c:8.17-18: `p' -> ([1..0xFFFFFFFF] : (Name(struct pair))[{0}].0*) 6 | null_ptr.c:9.6-9: `a + 1' -> [-0x7FFFFFFF..0x7FFFFFFF] 7 | null_ptr.c:9.6-7: `a' -> [--..--] 8 | null_ptr.c:10.20-44: `(p->i + p->j) + 1 == a' -> {0x1} 9 | null_ptr.c:10.21-38: `(p->i + p->j) + 1' -> [-0x7FFFFFFF..0x7FFFFFFF] 10 | null_ptr.c:10.22-33: `p->i + p->j' -> [-0x80000000..0x7FFFFFFE] 11 | null_ptr.c:10.22-26: `p->i' -> [--..--] 12 | null_ptr.c:10.22-23: `p' -> ([1..0xFFFFFFFB] : (Name(struct pair))[{0}].0*) 13 | null_ptr.c:10.29-33: `p->j' -> [--..--] 14 | null_ptr.c:10.29-30: `p' -> ([1..0xFFFFFFFB] : (Name(struct pair))[{0}].0*) 15 | null_ptr.c:10.43-44: `a' -> [-0x7FFFFFFF..0x7FFFFFFF] 16 | Unproved regular alarms: 17 | null_ptr.c:8: Memory_access(p->i, read) {true;false} 18 | Unproved additional alarms: 19 | Proved 3/4 regular alarms 20 | Unproved 1 regular alarms and 0 additional alarms. 21 | null_ptr.c:10: assertion is TRUE (valid) (proved with abstract interpretation) 22 | Solved 1/1 user assertions, proved 1 23 | -------------------------------------------------------------------------------- /tests/types/null_ptr_types.c: -------------------------------------------------------------------------------- 1 | struct pair { 2 | int a; 3 | int b; 4 | }; 5 | 6 | void test(struct pair? p); 7 | -------------------------------------------------------------------------------- /tests/types/pair.c: -------------------------------------------------------------------------------- 1 | struct pair { 2 | int x; 3 | int y; 4 | } ; 5 | 6 | struct pair_of_pair { 7 | struct pair * p1 ; 8 | struct pair * p2 ; 9 | } ; 10 | 11 | void test_pair_eq(struct pair * a) { 12 | int c = a->x ; 13 | int d = a->y ; 14 | __VERIFIER_assert(c == d) ; 15 | __VERIFIER_flush_cache() ; 16 | } 17 | 18 | void test_pair_of_pair_eq(struct pair_of_pair * a) { 19 | int c = a->p1->x ; 20 | int d = a->p2->y ; 21 | __VERIFIER_assert(c == d) ; 22 | __VERIFIER_flush_cache() ; 23 | } 24 | 25 | void test_pair_of_pair_eq2(struct pair_of_pair * a) { 26 | struct pair * p = a->p1 ; 27 | int c = p->x ; 28 | int d = p->y ; 29 | __VERIFIER_assert(c == d) ; 30 | __VERIFIER_flush_cache() ; 31 | } 32 | 33 | void test_pair_of_pair_eq3(struct pair * a, struct pair * b) { 34 | a->x = 1 ; 35 | a->y = 4 ; 36 | a->x = b->x ; 37 | int c = a->x ; 38 | int d = a->y ; 39 | __VERIFIER_assert(c == d) ; 40 | __VERIFIER_flush_cache() ; 41 | } 42 | 43 | void write_1_x_4(struct pair * a) { 44 | a->x = 1 ; 45 | a->y = 4 ; 46 | __VERIFIER_flush_cache() ; 47 | } 48 | 49 | void main() {} 50 | -------------------------------------------------------------------------------- /tests/types/pair2.c: -------------------------------------------------------------------------------- 1 | struct pair { 2 | int x; 3 | int y; 4 | }; 5 | 6 | void test_const1(struct pair *p) { 7 | p->x = 4 ; 8 | p->y = 2 ; 9 | __VERIFIER_flush_cache() ; 10 | } 11 | 12 | void test_const2(struct pair *p) { 13 | p->x = 2 ; 14 | p->y = 2 ; 15 | __VERIFIER_flush_cache() ; 16 | } 17 | 18 | 19 | void test_exist1(struct pair *p) { 20 | int x = 3 ; 21 | p->x = 3 ; 22 | p->y = 3 ; 23 | __VERIFIER_flush_cache() ; 24 | } 25 | 26 | void test_exist2(struct pair *p, int * a) { 27 | p->x = *a ; 28 | p->y = *a ; 29 | __VERIFIER_flush_cache() ; 30 | } 31 | 32 | void test_exist3(struct pair *p, int * a, int * b) { 33 | p->x = *a ; 34 | p->y = *b ; 35 | __VERIFIER_flush_cache() ; 36 | } 37 | 38 | void main() {} 39 | -------------------------------------------------------------------------------- /tests/types/pair2_test_const1_pair2_types.cdump: -------------------------------------------------------------------------------- 1 | pair2.c:7.2-3: `p' -> ([1..0xFFFFFFFF] : ({self : Name(struct pair)[{0}].(0)* | (self != 0)})) 2 | pair2.c:8.2-3: `p' -> ([1..0xFFFFFFFF] : ({self : Name(struct pair)[{0}].(0)* | (self != 0)})) 3 | Unproved regular alarms: 4 | Unproved additional alarms: 5 | Proved 2/2 regular alarms 6 | Unproved 0 regular alarms and 0 additional alarms. 7 | Solved 0/0 user assertions, proved 0 8 | -------------------------------------------------------------------------------- /tests/types/pair2_test_const2_pair2_types.cdump: -------------------------------------------------------------------------------- 1 | pair2.c:13.2-3: `p' -> ([1..0xFFFFFFFF] : ({self : Name(struct pair)[{0}].(0)* | (self != 0)})) 2 | pair2.c:14.2-3: `p' -> ([1..0xFFFFFFFF] : ({self : Name(struct pair)[{0}].(0)* | (self != 0)})) 3 | Unproved regular alarms: 4 | Unproved additional alarms: 5 | + Return -> typing_store ; 6 | Proved 2/2 regular alarms 7 | Unproved 0 regular alarms and 1 additional alarms. 8 | Solved 0/0 user assertions, proved 0 9 | -------------------------------------------------------------------------------- /tests/types/pair2_test_exist1_pair2_types.cdump: -------------------------------------------------------------------------------- 1 | pair2.c:21.2-3: `p' -> ([1..0xFFFFFFFF] : ({self : Name(struct pair)[{0}].(0)* | (self != 0)})) 2 | pair2.c:22.2-3: `p' -> ([1..0xFFFFFFFF] : ({self : Name(struct pair)[{0}].(0)* | (self != 0)})) 3 | Unproved regular alarms: 4 | Unproved additional alarms: 5 | + Return -> typing_store ; 6 | Proved 2/2 regular alarms 7 | Unproved 0 regular alarms and 1 additional alarms. 8 | Solved 0/0 user assertions, proved 0 9 | -------------------------------------------------------------------------------- /tests/types/pair2_test_exist2_pair2_types.cdump: -------------------------------------------------------------------------------- 1 | pair2.c:27.2-3: `p' -> ([1..0xFFFFFFFF] : ({self : Name(struct pair)[{0}].(0)* | (self != 0)})) 2 | pair2.c:27.9-11: `*a' -> [--..--] 3 | pair2.c:27.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 4 | pair2.c:28.2-3: `p' -> ([1..0xFFFFFFFF] : ({self : Name(struct pair)[{0}].(0)* | (self != 0)})) 5 | pair2.c:28.9-11: `*a' -> [--..--] 6 | pair2.c:28.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 7 | Unproved regular alarms: 8 | Unproved additional alarms: 9 | + Return -> typing_store ; 10 | Proved 4/4 regular alarms 11 | Unproved 0 regular alarms and 1 additional alarms. 12 | Solved 0/0 user assertions, proved 0 13 | -------------------------------------------------------------------------------- /tests/types/pair2_test_exist3_pair2_types.cdump: -------------------------------------------------------------------------------- 1 | pair2.c:33.2-3: `p' -> ([1..0xFFFFFFFF] : ({self : Name(struct pair)[{0}].(0)* | (self != 0)})) 2 | pair2.c:33.9-11: `*a' -> [--..--] 3 | pair2.c:33.10-11: `a' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 4 | pair2.c:34.2-3: `p' -> ([1..0xFFFFFFFF] : ({self : Name(struct pair)[{0}].(0)* | (self != 0)})) 5 | pair2.c:34.9-11: `*b' -> [--..--] 6 | pair2.c:34.10-11: `b' -> ([1..0xFFFFFFFF] : ({self : int(4)[{0}].(0)* | (self != 0)})) 7 | Unproved regular alarms: 8 | Unproved additional alarms: 9 | + pair2.c:34 : { p->y = *b; } -> typing_store ; 10 | + Return -> typing_store ; 11 | Proved 4/4 regular alarms 12 | Unproved 0 regular alarms and 2 additional alarms. 13 | Solved 0/0 user assertions, proved 0 14 | -------------------------------------------------------------------------------- /tests/types/pair2_types.c: -------------------------------------------------------------------------------- 1 | struct pair { 2 | (int with self = 4) x; 3 | (int with self = 2) y; 4 | }; 5 | 6 | void test_const1(struct pair+ p); 7 | 8 | void test_const2(struct pair+ p); 9 | 10 | void test_exist1(struct pair+ p); 11 | 12 | void test_exist2(struct pair+ p, int+ a) ; 13 | 14 | void test_exist3(struct pair+ p, int+ a, int+ b) ; 15 | -------------------------------------------------------------------------------- /tests/types/pair2_types2.c: -------------------------------------------------------------------------------- 1 | type paireq = ∃ a : int. struct { 2 | (int with self = a) x; 3 | (int with self = a) y; 4 | } 5 | 6 | void test_const1(paireq+ p); 7 | 8 | void test_const2(paireq+ p); 9 | 10 | void test_exist1(paireq+ p); 11 | 12 | void test_exist2(paireq+ p, int+ a) ; 13 | 14 | void test_exist3(paireq+ p, int+ a, int+ b) ; 15 | -------------------------------------------------------------------------------- /tests/types/pair_test_pair_eq_pair_types.cdump: -------------------------------------------------------------------------------- 1 | pair.c:12.9-13: `a->x' -> [--..--] 2 | pair.c:12.9-10: `a' -> ([1..0xFFFFFFFF] : ({self : Name(pair_eq)[{0}].(0)* | (self != 0)})) 3 | pair.c:13.9-13: `a->y' -> [--..--] 4 | pair.c:13.9-10: `a' -> ([1..0xFFFFFFFF] : ({self : Name(pair_eq)[{0}].(0)* | (self != 0)})) 5 | pair.c:14.19-25: `c == d' -> {0x1} 6 | pair.c:14.19-20: `c' -> [--..--] 7 | pair.c:14.24-25: `d' -> [--..--] 8 | Unproved regular alarms: 9 | Unproved additional alarms: 10 | Proved 2/2 regular alarms 11 | Unproved 0 regular alarms and 0 additional alarms. 12 | pair.c:14: assertion is TRUE (valid) (proved with abstract interpretation) 13 | Solved 1/1 user assertions, proved 1 14 | -------------------------------------------------------------------------------- /tests/types/pair_test_pair_of_pair_eq2_pair_types.cdump: -------------------------------------------------------------------------------- 1 | pair.c:26.19-24: `a->p1' -> ([1..0xFFFFFFFF] : ({self : Name(pair_eq)[{0}].(0)* | (self != 0)})) 2 | pair.c:26.19-20: `a' -> ([1..0xFFFFFFFF] : ({self : Name(pair_of_pair)[{0}].(0)* | (self != 0)})) 3 | pair.c:27.9-13: `p->x' -> [--..--] 4 | pair.c:27.9-10: `p' -> ([1..0xFFFFFFFF] : ({self : Name(pair_eq)[{0}].(0)* | (self != 0)})) 5 | pair.c:28.9-13: `p->y' -> [--..--] 6 | pair.c:28.9-10: `p' -> ([1..0xFFFFFFFF] : ({self : Name(pair_eq)[{0}].(0)* | (self != 0)})) 7 | pair.c:29.19-25: `c == d' -> {0x1} 8 | pair.c:29.19-20: `c' -> [--..--] 9 | pair.c:29.24-25: `d' -> [--..--] 10 | Unproved regular alarms: 11 | Unproved additional alarms: 12 | Proved 3/3 regular alarms 13 | Unproved 0 regular alarms and 0 additional alarms. 14 | pair.c:29: assertion is TRUE (valid) (proved with abstract interpretation) 15 | Solved 1/1 user assertions, proved 1 16 | -------------------------------------------------------------------------------- /tests/types/pair_test_pair_of_pair_eq3_pair_types.cdump: -------------------------------------------------------------------------------- 1 | pair.c:34.1-2: `a' -> ([1..0xFFFFFFFF] : ({self : Name(pair_eq)[{0}].(0)* | (self != 0)})) 2 | pair.c:35.1-2: `a' -> ([1..0xFFFFFFFF] : ({self : Name(pair_eq)[{0}].(0)* | (self != 0)})) 3 | pair.c:36.1-2: `a' -> ([1..0xFFFFFFFB] : ({self : Name(pair_eq)[{0}].(0)* | (self != 0)})) 4 | pair.c:36.8-12: `b->x' -> [--..--] 5 | pair.c:36.8-9: `b' -> ([1..0xFFFFFFFF] : ({self : Name(pair_eq)[{0}].(0)* | (self != 0)})) 6 | pair.c:37.9-13: `a->x' -> [--..--] 7 | pair.c:37.9-10: `a' -> ([1..0xFFFFFFFB] : ({self : Name(pair_eq)[{0}].(0)* | (self != 0)})) 8 | pair.c:38.9-13: `a->y' -> [--..--] 9 | pair.c:38.9-10: `a' -> ([1..0xFFFFFFFB] : ({self : Name(pair_eq)[{0}].(0)* | (self != 0)})) 10 | pair.c:39.19-25: `c == d' -> {0; 1} 11 | pair.c:39.19-20: `c' -> [--..--] 12 | pair.c:39.24-25: `d' -> [--..--] 13 | Unproved regular alarms: 14 | Unproved additional alarms: 15 | + pair.c:36 : { a->x = b->x; } -> typing_store ; 16 | Proved 6/6 regular alarms 17 | Unproved 0 regular alarms and 1 additional alarms. 18 | pair.c:39: assertion is FALSE (counter-example exists) (proved with smt solving) 19 | Solved 1/1 user assertions, proved 0 20 | -------------------------------------------------------------------------------- /tests/types/pair_test_pair_of_pair_eq_pair_types.cdump: -------------------------------------------------------------------------------- 1 | pair.c:19.9-17: `(a->p1)->x' -> [--..--] 2 | pair.c:19.9-14: `a->p1' -> ([1..0xFFFFFFFF] : ({self : Name(pair_eq)[{0}].(0)* | (self != 0)})) 3 | pair.c:19.9-10: `a' -> ([1..0xFFFFFFFF] : ({self : Name(pair_of_pair)[{0}].(0)* | (self != 0)})) 4 | pair.c:20.9-17: `(a->p2)->y' -> [--..--] 5 | pair.c:20.9-14: `a->p2' -> ([1..0xFFFFFFFF] : ({self : Name(pair_eq)[{0}].(0)* | (self != 0)})) 6 | pair.c:20.9-10: `a' -> ([1..0xFFFFFFFF] : ({self : Name(pair_of_pair)[{0}].(0)* | (self != 0)})) 7 | pair.c:21.19-25: `c == d' -> {0; 1} 8 | pair.c:21.19-20: `c' -> [--..--] 9 | pair.c:21.24-25: `d' -> [--..--] 10 | Unproved regular alarms: 11 | Unproved additional alarms: 12 | Proved 4/4 regular alarms 13 | Unproved 0 regular alarms and 0 additional alarms. 14 | pair.c:21: assertion is FALSE (counter-example exists) (proved with smt solving) 15 | Solved 1/1 user assertions, proved 0 16 | -------------------------------------------------------------------------------- /tests/types/pair_types.c: -------------------------------------------------------------------------------- 1 | type pair_eq = ∃ a : int . struct { 2 | (int with self = a) x; 3 | (int with self = a) y; 4 | } 5 | 6 | type pair_of_pair = struct { 7 | pair_eq+ p1; 8 | pair_eq+ p2; 9 | } 10 | 11 | void test_pair_eq(pair_eq+ a); 12 | void test_pair_of_pair_eq(pair_of_pair+ a); 13 | void test_pair_of_pair_eq2(pair_of_pair+ a); 14 | void test_pair_of_pair_eq3(pair_eq+ a, pair_eq+ b); 15 | void write_1_x_4(pair_eq+ a); 16 | 17 | -------------------------------------------------------------------------------- /tests/types/pair_write_1_x_4_pair_types.cdump: -------------------------------------------------------------------------------- 1 | pair.c:44.1-2: `a' -> ([1..0xFFFFFFFF] : ({self : Name(pair_eq)[{0}].(0)* | (self != 0)})) 2 | pair.c:45.1-2: `a' -> ([1..0xFFFFFFFF] : ({self : Name(pair_eq)[{0}].(0)* | (self != 0)})) 3 | Unproved regular alarms: 4 | Unproved additional alarms: 5 | + Return -> typing_store ; 6 | Proved 2/2 regular alarms 7 | Unproved 0 regular alarms and 1 additional alarms. 8 | Solved 0/0 user assertions, proved 0 9 | -------------------------------------------------------------------------------- /tests/types/paireq2_types.c: -------------------------------------------------------------------------------- 1 | type paireq = ∃ a:int. struct { 2 | (int with self = a) x; 3 | (int with self = a) y; 4 | } 5 | 6 | void test_const1(paireq+ p); 7 | 8 | void test_const2(paireq+ p); 9 | 10 | void test_exist1(paireq+ p); 11 | 12 | void test_exist2(paireq+ p, int+ a) ; 13 | 14 | void test_exist3(paireq+ p, int+ a, int+ b) ; 15 | -------------------------------------------------------------------------------- /tests/types/param_types1.c: -------------------------------------------------------------------------------- 1 | type int1 = int with self = 1 2 | 3 | type app1 = int with self = a 4 | 5 | void test(app1(1)+, int1+); 6 | -------------------------------------------------------------------------------- /tests/types/param_types2.c: -------------------------------------------------------------------------------- 1 | type int1 = int with self = 1 2 | 3 | type app1 = int with self = a 4 | 5 | void test(int1+,app1(1)+); 6 | -------------------------------------------------------------------------------- /tests/types/param_types3.c: -------------------------------------------------------------------------------- 1 | type int2 = int with self = 2 2 | 3 | type app1 = int with self = a 4 | 5 | void main (app1(1)+,int2+); 6 | -------------------------------------------------------------------------------- /tests/types/param_types4.c: -------------------------------------------------------------------------------- 1 | type app1 = int with self = a 2 | type app2 = int with self = b 3 | 4 | void test(app1(1)+,app2(1)+); 5 | -------------------------------------------------------------------------------- /tests/types/param_types5.c: -------------------------------------------------------------------------------- 1 | type app3 = (int with self = (a + b)) 2 | type app4 = (int with self = b) 3 | 4 | void test(app4(2,5)+,(app3(1, 1)+)); 5 | -------------------------------------------------------------------------------- /tests/types/point.c: -------------------------------------------------------------------------------- 1 | //#include "binsec-stubs.h" 2 | 3 | typedef struct { 4 | int x, y ; 5 | } Point ; 6 | 7 | typedef struct { 8 | int x, y, color ; 9 | } ColorPoint ; 10 | 11 | typedef struct { 12 | int common ; 13 | Point * p ; 14 | } PS; 15 | 16 | typedef struct { 17 | int common ; 18 | ColorPoint * p ; 19 | } CPS; 20 | 21 | enum Color {RED , BLUE , GREEN}; 22 | 23 | 24 | void test1(Point * pt, ColorPoint * pcp) { 25 | //Point p = *pt; 26 | __VERIFIER_debug_int32 ((int) pcp) ; 27 | pcp = (ColorPoint *) pt ; 28 | __VERIFIER_debug_int32 ((int) pcp) ; 29 | pcp->x = 1 ; 30 | pcp->color = RED ; 31 | } 32 | 33 | void test2(PS * psp, CPS * cps, CPS * cpsp, Point * pt, Point * q, ColorPoint * cp) { 34 | psp = (PS *) cps ; 35 | cpsp = cps ; 36 | q = pt ; 37 | psp->p = q ; 38 | cp = cpsp->p ; 39 | cp->color = RED ; 40 | } 41 | 42 | void test3(Point * pt, Point ** pp, ColorPoint ** q) { 43 | pp = (Point**) q ; 44 | *pp = pt ; 45 | (*q)->color = RED ; 46 | } 47 | 48 | 49 | void main() {} 50 | -------------------------------------------------------------------------------- /tests/types/point_types.c: -------------------------------------------------------------------------------- 1 | struct Point { 2 | int x; 3 | int y ; 4 | }; 5 | 6 | struct ColorPoint { 7 | int x; 8 | int y; 9 | int color ; 10 | }; 11 | 12 | struct PS { 13 | int common ; 14 | struct Point+ p ; 15 | } 16 | 17 | struct CPS { 18 | int common ; 19 | struct ColorPoint+ p ; 20 | } 21 | 22 | void test1(struct Point * pt, struct ColorPoint * pcp); 23 | 24 | void test2(struct PS * psp, struct CPS * cps, struct CPS * cpsp, struct Point * pt, struct Point * q, struct ColorPoint * cp); 25 | 26 | void test3(struct Point * pt, struct Point ** pp, struct ColorPoint ** q); 27 | 28 | -------------------------------------------------------------------------------- /tests/types/ptr_arith.c: -------------------------------------------------------------------------------- 1 | struct foo { 2 | int p[5]; 3 | }; 4 | 5 | void test(struct foo * a){ 6 | int * ptr = &(a->p) ; 7 | ptr += 3 ; 8 | ptr += (-1) ; 9 | ptr = ptr ; 10 | } 11 | 12 | void main(){} 13 | -------------------------------------------------------------------------------- /tests/types/ptr_arith_test_ptr_arith_types.cdump: -------------------------------------------------------------------------------- 1 | ptr_arith.c:6.15-21: `(int *)(& a->p)' -> ([1..0xFFFFFFFF] : ({self : Name(struct foo)[{0}].(0)* | (self != 0)})) 2 | ptr_arith.c:6.15-21: `& a->p' -> ([1..0xFFFFFFFF] : ({self : Name(struct foo)[{0}].(0)* | (self != 0)})) 3 | ptr_arith.c:6.16-17: `a' -> ([1..0xFFFFFFFF] : ({self : Name(struct foo)[{0}].(0)* | (self != 0)})) 4 | ptr_arith.c:7.2-10: `ptr + 3' -> ([1..0xFFFFFFFF] : ({self : Name(struct foo)[{0}].(0)* | (self != 0)})) + 0xC 5 | ptr_arith.c:7.2-5: `ptr' -> ([1..0xFFFFFFFF] : ({self : Name(struct foo)[{0}].(0)* | (self != 0)})) 6 | ptr_arith.c:8.2-13: `ptr + -1' -> ([13..0xFFFFFFFF] : ({self : Name(struct foo)[{0}].(12)* | (self != 0)})) + 0x-4 7 | ptr_arith.c:8.2-5: `ptr' -> ([13..0xFFFFFFFF] : ({self : Name(struct foo)[{0}].(12)* | (self != 0)})) 8 | ptr_arith.c:9.8-11: `ptr' -> ([9..0xFFFFFFFB] : ({self : Name(struct foo)[{0}].(8)* | (self != 0)})) 9 | Unproved regular alarms: 10 | Unproved additional alarms: 11 | Proved 0/0 regular alarms 12 | Unproved 0 regular alarms and 0 additional alarms. 13 | Solved 0/0 user assertions, proved 0 14 | -------------------------------------------------------------------------------- /tests/types/ptr_arith_types.c: -------------------------------------------------------------------------------- 1 | struct foo { 2 | int[5] p; 3 | }; 4 | 5 | void test(struct foo+ a); 6 | -------------------------------------------------------------------------------- /tests/types/radio.c: -------------------------------------------------------------------------------- 1 | //#include "binsec-stubs.h" 2 | 3 | typedef struct { 4 | int hour, minute ; 5 | } Clock ; 6 | 7 | typedef struct { 8 | int frequency ; 9 | } Radio ; 10 | 11 | typedef struct { 12 | Clock clock; 13 | Radio radio; 14 | } ClockRadio ; 15 | 16 | 17 | void test(ClockRadio * cl, Clock * c, Radio * r) { 18 | //ClockRadio cr = *cl ; 19 | 20 | c = &(cl->clock) ; 21 | r = (Radio*) c + 1 ; 22 | r->frequency = 91 ; 23 | } 24 | 25 | void main() {} 26 | -------------------------------------------------------------------------------- /tests/types/radio_types.c: -------------------------------------------------------------------------------- 1 | struct Clock { 2 | int hour; 3 | int minute ; 4 | }; 5 | 6 | struct Radio { 7 | int frequency ; 8 | }; 9 | 10 | struct ClockRadio { 11 | struct Clock clock; 12 | struct Radio radio; 13 | }; 14 | 15 | void test(struct ClockRadio * cl, struct Clock * c, struct Radio * r); 16 | -------------------------------------------------------------------------------- /tests/types/reduce1.c: -------------------------------------------------------------------------------- 1 | int a = 0; 2 | void test() { 3 | while (0) { 4 | while (malloc_T) 5 | ; 6 | a = malloc_T; 7 | } 8 | } 9 | 10 | void main(){} 11 | -------------------------------------------------------------------------------- /tests/types/reduce10.c: -------------------------------------------------------------------------------- 1 | struct rbnode { 2 | struct rbnode *left; 3 | struct rbnode *right; 4 | } *root, *n; 5 | 6 | struct rbtree { 7 | struct rbnode *root 8 | } 9 | 10 | main() {} 11 | 12 | main_insert(struct rbtree *tree, struct rbnode *node) { 13 | root = tree->root; 14 | n = node->right; 15 | if (root->left > 0) { 16 | node->right = root->left ; 17 | } 18 | __VERIFIER_flush_cache () ; 19 | } 20 | -------------------------------------------------------------------------------- /tests/types/reduce10_types.c: -------------------------------------------------------------------------------- 1 | struct rbnode { 2 | struct rbnode* rbe_left; 3 | struct rbnode+ rbe_right; 4 | struct rbnode+ rbe_parent; 5 | int rbe_color; 6 | int i; 7 | } 8 | 9 | struct rbtree { 10 | struct rbnode+ rbh_root; 11 | } 12 | 13 | void main_insert(struct rbtree+, struct rbnode+); 14 | -------------------------------------------------------------------------------- /tests/types/reduce11.c: -------------------------------------------------------------------------------- 1 | //#include "binsec-stubs.h" 2 | struct { 3 | int a 4 | } * b; 5 | main_d() { b->a = NULL; } 6 | main() {} 7 | -------------------------------------------------------------------------------- /tests/types/reduce11_types.c: -------------------------------------------------------------------------------- 1 | struct snode { 2 | struct snode? spe_left; 3 | struct snode? spe_right; 4 | int i; 5 | }; 6 | 7 | struct stree { 8 | struct snode+ sph_root; 9 | }; 10 | 11 | void main_d(struct stree+); 12 | -------------------------------------------------------------------------------- /tests/types/reduce12.c: -------------------------------------------------------------------------------- 1 | //#include "/home/julien/Repos53/codex/tests/creduce2/rbtree_augmented.h" 2 | #define u32 int 3 | 4 | struct rb_node { 5 | unsigned long __rb_parent_color; 6 | struct rb_node *rb_right; 7 | struct rb_node *rb_left; 8 | } __attribute__((aligned(sizeof(long)))); 9 | /* The alignment might seem pointless, but allegedly CRIS needs it */ 10 | 11 | struct rb_root { 12 | struct rb_node *rb_node; 13 | }; 14 | 15 | void test(struct rb_root *root, u32 ) { 16 | struct rb_node *node = root->rb_node; 17 | while (node) { 18 | node = node->rb_left; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/types/reduce12_test_reduce12_types.cdump: -------------------------------------------------------------------------------- 1 | reduce12.c:16.25-38: `root->rb_node' -> Union {{ ([5..0xFFFFFFFF] : 2 | ({self : Name(struct test_node)[{0}].(4)* | (self != 0)})) with BVal {true} }; 3 | { {0} with BVal {true} };} 4 | reduce12.c:16.25-29: `root' -> ([1..0xFFFFFFFF] : ({self : Name(struct rb_root)[{0}].(0)* | (self != 0)})) 5 | reduce12.c:17.9-13: `node' -> Union {{ ([5..0xFFFFFFFF] : 6 | ({self : Name(struct test_node)[{0}].(4)* | (self != 0)})) with BVal {true} }; 7 | { {0} with BVal {true} };} 8 | reduce12.c:18.11-24: `node->rb_left' -> Union {{ ([5..0xFFFFFFFF] : 9 | ({self : Name(struct test_node)[{0}].(4)* | (self != 0)})) with BVal {true} }; 10 | { {0} with BVal {true} };} 11 | reduce12.c:18.11-15: `node' -> ([5..0xFFFFFFFF] : ({self : Name(struct test_node)[{0}].(4)* | (self != 0)})) 12 | Unproved regular alarms: 13 | Unproved additional alarms: 14 | Proved 2/2 regular alarms 15 | Unproved 0 regular alarms and 0 additional alarms. 16 | Solved 0/0 user assertions, proved 0 17 | -------------------------------------------------------------------------------- /tests/types/reduce12_types.c: -------------------------------------------------------------------------------- 1 | type rbnode_ptr = ∃ p : struct test_node+. union { 2 | int with (self = p + 4) a ; 3 | int with self = 0 b; 4 | } 5 | 6 | struct rb_node { 7 | int parent_color ; 8 | rbnode_ptr right ; 9 | rbnode_ptr left ; 10 | }; 11 | 12 | struct test_node { 13 | int key ; 14 | struct rb_node rb ; 15 | }; 16 | 17 | struct rb_root_cached { 18 | rbnode_ptr rb_root; 19 | rbnode_ptr rb_leftmost; 20 | }; 21 | 22 | struct rb_root { 23 | rbnode_ptr rb_node; 24 | }; 25 | 26 | void test(struct rb_root+ root, int key); 27 | -------------------------------------------------------------------------------- /tests/types/reduce1_types.c: -------------------------------------------------------------------------------- 1 | void test(); 2 | -------------------------------------------------------------------------------- /tests/types/reduce2.c: -------------------------------------------------------------------------------- 1 | struct a d; 2 | struct a { 3 | struct a *b; 4 | struct a *c; 5 | }; 6 | 7 | void main() {} 8 | 9 | void test(int x, struct a *f) { 10 | struct a a = *f; 11 | d = *a.b; 12 | } 13 | -------------------------------------------------------------------------------- /tests/types/reduce2_test_reduce2_types.cdump: -------------------------------------------------------------------------------- 1 | reduce2.c:10.15-17: `*f' -> Concat [{ 32 -> {0} or ([1..0xFFFFFFFF] : (Name(struct rbnode))[{0}].0*) of size 32 }; 2 | { 0 -> {0} or ([1..0xFFFFFFFF] : (Name(struct rbnode))[{0}].0*) of size 32 }] 3 | reduce2.c:10.16-17: `f' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 4 | reduce2.c:11.6-10: `*(a.b)' -> Concat [{ 32 -> {0} or ([1..0xFFFFFFFF] : (Name(struct rbnode))[{0}].0*) of size 32 }; 5 | { 0 -> {0} or ([1..0xFFFFFFFF] : (Name(struct rbnode))[{0}].0*) of size 32 }] 6 | reduce2.c:11.7-10: `a.b' -> {0} or ([1..0xFFFFFFFF] : (Name(struct rbnode))[{0}].0*) 7 | Unproved regular alarms: 8 | reduce2.c:11: Memory_access(*(a.b), read) {true;false} 9 | Unproved additional alarms: 10 | Proved 2/3 regular alarms 11 | Unproved 1 regular alarms and 0 additional alarms. 12 | Solved 0/0 user assertions, proved 0 13 | -------------------------------------------------------------------------------- /tests/types/reduce2_types.c: -------------------------------------------------------------------------------- 1 | struct rbnode { 2 | struct rbnode? rbe_left; 3 | struct rbnode? rbe_right; 4 | struct rbnode? rbe_parent; 5 | int rbe_color; 6 | int i; 7 | }; 8 | 9 | struct rbtree { 10 | struct rbnode+ rbh_root; 11 | }; 12 | 13 | void test(struct rbtree+ a,struct rbnode+ b); 14 | -------------------------------------------------------------------------------- /tests/types/reduce3.c: -------------------------------------------------------------------------------- 1 | struct a { 2 | struct a *b; 3 | struct a *c; 4 | } f, *g; 5 | 6 | struct d { 7 | struct a *e; 8 | }; 9 | 10 | void main() {} 11 | 12 | void test(struct d *h, __attribute__(()) j) { 13 | struct d i = *h; 14 | struct a *a = j; 15 | f = *i.e; 16 | g = f.b; 17 | a->c = 0; 18 | if (f.b) 19 | g->b = j; 20 | } 21 | -------------------------------------------------------------------------------- /tests/types/reduce3_test_reduce3_types.cdump: -------------------------------------------------------------------------------- 1 | reduce3.c:13.15-17: `*h' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 2 | reduce3.c:13.16-17: `h' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbtree)[{0}].(0)* | (self != 0)})) 3 | reduce3.c:14.16-17: `(struct a *)j' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 4 | reduce3.c:14.16-17: `j' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 5 | reduce3.c:15.6-10: `*(i.e)' -> Concat [{ 32 -> {0} or ([1..0xFFFFFFFF] : (Name(struct rbnode))[{0}].0*) of size 32 }; 6 | { 0 -> {0} or ([1..0xFFFFFFFF] : (Name(struct rbnode))[{0}].0*) of size 32 }] 7 | reduce3.c:15.7-10: `i.e' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 8 | reduce3.c:16.6-9: `f.b' -> {0} or ([1..0xFFFFFFFF] : (Name(struct rbnode))[{0}].0*) 9 | reduce3.c:17.2-3: `a' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 10 | reduce3.c:18.6-9: `f.b' -> {0} or ([1..0xFFFFFFFF] : (Name(struct rbnode))[{0}].0*) 11 | reduce3.c:19.4-5: `g' -> ([1..0xFFFFFFFF] : (Name(struct rbnode))[{0}].0*) 12 | reduce3.c:19.11-12: `(struct a *)j' -> ([1..0xFFFFFFFB] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 13 | reduce3.c:19.11-12: `j' -> ([1..0xFFFFFFFB] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 14 | Unproved regular alarms: 15 | Unproved additional alarms: 16 | Proved 7/7 regular alarms 17 | Unproved 0 regular alarms and 0 additional alarms. 18 | Solved 0/0 user assertions, proved 0 19 | -------------------------------------------------------------------------------- /tests/types/reduce3_types.c: -------------------------------------------------------------------------------- 1 | struct rbnode { 2 | struct rbnode? rbe_left; 3 | struct rbnode? rbe_right; 4 | struct rbnode? rbe_parent; 5 | int rbe_color; 6 | int i; 7 | }; 8 | 9 | struct rbtree { 10 | struct rbnode+ rbh_root; 11 | }; 12 | 13 | void test(struct rbtree+ a,struct rbnode+ b); 14 | -------------------------------------------------------------------------------- /tests/types/reduce4.c: -------------------------------------------------------------------------------- 1 | struct rbnode { 2 | struct rbnode *left; 3 | struct rbnode *right; 4 | } *root, *n; 5 | 6 | struct rbtree { 7 | struct rbnode *root; 8 | }; 9 | 10 | void main() {} 11 | 12 | void test(struct rbtree *tree, struct rbnode *node) { 13 | root = tree->root; 14 | n = node->right; 15 | node->right = root->left ; 16 | if (root->left) 17 | n->left = node; 18 | } 19 | -------------------------------------------------------------------------------- /tests/types/reduce4_test_reduce4_types.cdump: -------------------------------------------------------------------------------- 1 | reduce4.c:13.9-19: `tree->root' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 2 | reduce4.c:13.9-13: `tree' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbtree)[{0}].(0)* | (self != 0)})) 3 | reduce4.c:14.6-17: `node->right' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 4 | reduce4.c:14.6-10: `node' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 5 | reduce4.c:15.2-6: `node' -> ([1..0xFFFFFFFB] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 6 | reduce4.c:15.16-26: `root->left' -> {0} or ([1..0xFFFFFFFF] : (Name(struct rbnode))[{0}].0*) 7 | reduce4.c:15.16-20: `root' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 8 | reduce4.c:16.6-16: `root->left' -> {0} or ([1..0xFFFFFFFF] : (Name(struct rbnode))[{0}].0*) 9 | reduce4.c:16.6-10: `root' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 10 | reduce4.c:17.4-5: `n' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 11 | reduce4.c:17.14-18: `node' -> ([1..0xFFFFFFFB] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 12 | Unproved regular alarms: 13 | Unproved additional alarms: 14 | Proved 6/6 regular alarms 15 | Unproved 0 regular alarms and 0 additional alarms. 16 | Solved 0/0 user assertions, proved 0 17 | -------------------------------------------------------------------------------- /tests/types/reduce4_types.c: -------------------------------------------------------------------------------- 1 | struct rbnode { 2 | struct rbnode* rbe_left; 3 | struct rbnode+ rbe_right; 4 | struct rbnode+ rbe_parent; 5 | int rbe_color; 6 | int i; 7 | }; 8 | 9 | struct rbtree { 10 | struct rbnode+ rbh_root; 11 | }; 12 | 13 | void test(struct rbtree+ a, struct rbnode+ b); 14 | -------------------------------------------------------------------------------- /tests/types/reduce5.c: -------------------------------------------------------------------------------- 1 | struct rbnode { 2 | struct rbnode *left; 3 | struct rbnode *right; 4 | } *root, *n; 5 | 6 | struct rbtree { 7 | struct rbnode *root; 8 | }; 9 | 10 | void main() {} 11 | 12 | void test(struct rbtree *tree, struct rbnode *node) { 13 | root = tree->root; 14 | n = node->right; 15 | if (root->left > 0) { 16 | node->right = root->left ; 17 | } 18 | __VERIFIER_flush_cache () ; 19 | } 20 | -------------------------------------------------------------------------------- /tests/types/reduce5_test_reduce5_types.cdump: -------------------------------------------------------------------------------- 1 | reduce5.c:13.9-19: `tree->root' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 2 | reduce5.c:13.9-13: `tree' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbtree)[{0}].(0)* | (self != 0)})) 3 | reduce5.c:14.6-17: `node->right' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 4 | reduce5.c:14.6-10: `node' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 5 | reduce5.c:15.6-20: `root->left > (struct rbnode *)0' -> {0; 1} 6 | reduce5.c:15.6-16: `root->left' -> {0} or ([1..0xFFFFFFFF] : (Name(struct rbnode))[{0}].0*) 7 | reduce5.c:15.6-10: `root' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 8 | reduce5.c:16.4-8: `node' -> ([1..0xFFFFFFFB] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 9 | reduce5.c:16.18-28: `root->left' -> ([1..0xFFFFFFFF] : (Name(struct rbnode))[{0}].0*) 10 | reduce5.c:16.18-22: `root' -> ([1..0xFFFFFFFF] : ({self : Name(struct rbnode)[{0}].(0)* | (self != 0)})) 11 | Unproved regular alarms: 12 | Unproved additional alarms: 13 | Proved 5/5 regular alarms 14 | Unproved 0 regular alarms and 0 additional alarms. 15 | Solved 0/0 user assertions, proved 0 16 | -------------------------------------------------------------------------------- /tests/types/reduce5_types.c: -------------------------------------------------------------------------------- 1 | struct rbnode { 2 | struct rbnode* rbe_left; 3 | struct rbnode+ rbe_right; 4 | struct rbnode+ rbe_parent; 5 | int rbe_color; 6 | int i; 7 | }; 8 | 9 | struct rbtree { 10 | struct rbnode+ rbh_root; 11 | }; 12 | 13 | void test(struct rbtree+ a, struct rbnode+ b); 14 | -------------------------------------------------------------------------------- /tests/types/reduce6.c: -------------------------------------------------------------------------------- 1 | #include "reduce6.h" 2 | 3 | void test(struct jsw_avltree *a, int *data) { 4 | if (a->root == NULL) 5 | cmp_f(a->root->data, data); 6 | } 7 | 8 | void main() {} 9 | -------------------------------------------------------------------------------- /tests/types/reduce6_types.c: -------------------------------------------------------------------------------- 1 | struct jsw_avlnode { 2 | int balance; 3 | int+ data; 4 | struct jsw_avlnode*[2] link; 5 | }; 6 | 7 | struct jsw_avltree { 8 | struct jsw_avlnode* root; 9 | int size; 10 | }; 11 | 12 | struct jsw_avltrav { 13 | struct jsw_avltree* tree; 14 | struct jsw_avlnode* it; 15 | struct jsw_avlnode*[64] path; 16 | int top; 17 | }; 18 | 19 | void test(struct jsw_avltree+ tree); 20 | -------------------------------------------------------------------------------- /tests/types/reduce7.c: -------------------------------------------------------------------------------- 1 | struct { 2 | int a; 3 | } * b; 4 | 5 | void test() { b->a = 0; } 6 | 7 | void main() {} 8 | -------------------------------------------------------------------------------- /tests/types/reduce7_types.c: -------------------------------------------------------------------------------- 1 | struct snode { 2 | struct snode? spe_left; 3 | struct snode? spe_right; 4 | int i; 5 | }; 6 | 7 | struct stree { 8 | struct snode+ sph_root; 9 | }; 10 | 11 | void test(struct stree+ a); 12 | -------------------------------------------------------------------------------- /tests/types/reduce8.c: -------------------------------------------------------------------------------- 1 | struct a d; 2 | struct a { 3 | struct a *b; 4 | struct a *c 5 | } main() { 6 | } 7 | main_insert(struct e(), struct a *f) { 8 | struct a a = *f; 9 | d = *a.b; 10 | } 11 | -------------------------------------------------------------------------------- /tests/types/reduce8_types.c: -------------------------------------------------------------------------------- 1 | struct rbnode { 2 | struct rbnode* rbe_left; 3 | struct rbnode+ rbe_right; 4 | struct rbnode+ rbe_parent; 5 | int rbe_color; 6 | int i; 7 | } 8 | 9 | struct rbtree { 10 | struct rbnode+ rbh_root; 11 | } 12 | 13 | void main_insert(struct rbtree+, struct rbnode+); 14 | -------------------------------------------------------------------------------- /tests/types/reduce9.c: -------------------------------------------------------------------------------- 1 | struct rbnode { 2 | struct rbnode *left; 3 | struct rbnode *right; 4 | } *root, *n; 5 | 6 | struct rbtree { 7 | struct rbnode *root 8 | } 9 | 10 | main() {} 11 | 12 | main_insert(struct rbtree *tree, struct rbnode *node) { 13 | root = tree->root; 14 | n = node->right; 15 | node->right = root->left ; 16 | if (root->left) 17 | n->left = node; 18 | } 19 | -------------------------------------------------------------------------------- /tests/types/reduce9_types.c: -------------------------------------------------------------------------------- 1 | struct rbnode { 2 | struct rbnode* rbe_left; 3 | struct rbnode+ rbe_right; 4 | struct rbnode+ rbe_parent; 5 | int rbe_color; 6 | int i; 7 | } 8 | 9 | struct rbtree { 10 | struct rbnode+ rbh_root; 11 | } 12 | 13 | void main_insert(struct rbtree+, struct rbnode+); 14 | -------------------------------------------------------------------------------- /tests/types/store.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | void test(void** a, void ** b) { 4 | *a = *b ; 5 | __VERIFIER_flush_cache() ; 6 | } 7 | 8 | void main(){} 9 | 10 | -------------------------------------------------------------------------------- /tests/types/store_test_store_types.cdump: -------------------------------------------------------------------------------- 1 | store.c:4.3-4: `a' -> ([1..0xFFFFFFFF] : ({self : Name(int1)[{0}].(0)* | (self != 0)})) 2 | store.c:4.7-9: `*b' -> [--..--] 3 | store.c:4.8-9: `b' -> ([1..0xFFFFFFFF] : ({self : Name(foo1)[{0}].(0)* | (self != 0)})) 4 | Unproved regular alarms: 5 | Unproved additional alarms: 6 | + Return -> typing_store ; 7 | Proved 2/2 regular alarms 8 | Unproved 0 regular alarms and 1 additional alarms. 9 | Solved 0/0 user assertions, proved 0 10 | -------------------------------------------------------------------------------- /tests/types/store_test_store_types2.cdump: -------------------------------------------------------------------------------- 1 | store.c:4.3-4: `a' -> ([1..0xFFFFFFFF] : ({self : Name(foo1)[{0}].(0)* | (self != 0)})) 2 | store.c:4.7-9: `*b' -> [--..--] 3 | store.c:4.8-9: `b' -> ([1..0xFFFFFFFF] : ({self : Name(foo2)[{0}].(0)* | (self != 0)})) 4 | Unproved regular alarms: 5 | Unproved additional alarms: 6 | Proved 2/2 regular alarms 7 | Unproved 0 regular alarms and 0 additional alarms. 8 | Solved 0/0 user assertions, proved 0 9 | -------------------------------------------------------------------------------- /tests/types/store_test_store_types3.cdump: -------------------------------------------------------------------------------- 1 | store.c:4.3-4: `a' -> ([1..0xFFFFFFFF] : ({self : Name(foo1)[{0}].(0)* | (self != 0)})) 2 | store.c:4.7-9: `*b' -> {1} 3 | store.c:4.8-9: `b' -> ([1..0xFFFFFFFF] : ({self : Name(int1)[{0}].(0)* | (self != 0)})) 4 | Unproved regular alarms: 5 | Unproved additional alarms: 6 | Proved 2/2 regular alarms 7 | Unproved 0 regular alarms and 0 additional alarms. 8 | Solved 0/0 user assertions, proved 0 9 | -------------------------------------------------------------------------------- /tests/types/store_types.c: -------------------------------------------------------------------------------- 1 | type int1 = int with self = 1 2 | type foo1 = ∃ a : int . (int with self = a) 3 | 4 | void test(int1+ a, foo1+ b); 5 | 6 | -------------------------------------------------------------------------------- /tests/types/store_types1.c: -------------------------------------------------------------------------------- 1 | #include "binsec-stubs.h" 2 | 3 | type int1 = int with self = 1 4 | type foo1 = ∃ a . (int with self = a) 5 | 6 | void test(int1 * a, foo1 * b); 7 | 8 | -------------------------------------------------------------------------------- /tests/types/store_types2.c: -------------------------------------------------------------------------------- 1 | type foo1 = ∃ a : int . (int with self = a) 2 | type foo2 = ∃ b : int . (int with self = b) 3 | 4 | void test(foo1+ a, foo2+ b); 5 | -------------------------------------------------------------------------------- /tests/types/store_types3.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | type int1 = int with self = 1 4 | type foo1 = ∃ a : int . (int with self = a) 5 | 6 | void test(foo1+ a, int1+ b); 7 | 8 | -------------------------------------------------------------------------------- /tests/types/string15_types.c: -------------------------------------------------------------------------------- 1 | struct array_n15 { 2 | (int with self = 15) length ; 3 | (char[20])+ content ; 4 | } 5 | 6 | void test_access(struct array_n15 * str); 7 | void zeros(struct array_n15 * str); 8 | 9 | void fill_test(struct array_n15 * str); 10 | void fill_test_wrong(struct array_n15 * str); 11 | -------------------------------------------------------------------------------- /tests/types/string20_types.c: -------------------------------------------------------------------------------- 1 | struct array_n20 { 2 | (int with self = 20) length ; 3 | (char[20])+ content ; 4 | } 5 | 6 | void test_access(struct array_n20 * str); 7 | void zeros(struct array_n20 * str); 8 | 9 | void fill_test(struct array_n20 * str); 10 | void fill_test_wrong(struct array_n20 * str); 11 | -------------------------------------------------------------------------------- /tests/types/string_fill_test_string_types2.cdump: -------------------------------------------------------------------------------- 1 | string.c:71.14-26: `str->content' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 2 | string.c:71.14-17: `str' -> ([1..0xFFFFFFFF] : ({self : Name(struct string15)[{0}].(0)* | (self != 0)})) 3 | string.c:77.15-41: `str->content + str->length' -> ([16..0xFFFFFFFF] : ({self : (char(1))[20][{15}].(0)* | (self != 0)})) 4 | string.c:77.15-27: `str->content' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 5 | string.c:77.15-18: `str' -> ([1..0xFFFFFFFB] : ({self : Name(struct string15)[{0}].(0)* | (self != 0)})) 6 | string.c:77.30-41: `str->length' -> {15} 7 | string.c:77.30-33: `str' -> ([1..0xFFFFFFFB] : ({self : Name(struct string15)[{0}].(0)* | (self != 0)})) 8 | string.c:79.8-18: `ptr < last' -> {0; 1} 9 | string.c:79.8-11: `ptr' -> ([1..0xFFFFFFFF] : 10 | ({self : (char(1))[20][[0..0x7FFFFFFF]].(0)* | (self != 0)})) 11 | string.c:79.14-18: `last' -> ([16..0xFFFFFFFF] : ({self : (char(1))[20][{15}].(0)* | (self != 0)})) 12 | string.c:80.3-6: `ptr' -> ([1..0xFFFFFFFE] : 13 | ({self : (char(1))[20][[0..0x7FFFFFFF]].(0)* | (self != 0)})) 14 | string.c:81.2-7: `ptr + 1' -> ([1..0xFFFFFFFE] : 15 | ({self : (char(1))[20][[0..0x7FFFFFFF]].(0)* | (self != 0)})) + 0x1 16 | string.c:81.2-5: `ptr' -> ([1..0xFFFFFFFE] : 17 | ({self : (char(1))[20][[0..0x7FFFFFFF]].(0)* | (self != 0)})) 18 | Unproved regular alarms: 19 | Unproved additional alarms: 20 | Proved 4/4 regular alarms 21 | Unproved 0 regular alarms and 0 additional alarms. 22 | Solved 0/0 user assertions, proved 0 23 | -------------------------------------------------------------------------------- /tests/types/string_fill_test_string_types3.cdump: -------------------------------------------------------------------------------- 1 | string.c:71.14-26: `str->content' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 2 | string.c:71.14-17: `str' -> ([1..0xFFFFFFFF] : ({self : Name(struct string20)[{0}].(0)* | (self != 0)})) 3 | string.c:77.15-41: `str->content + str->length' -> ([21..0xFFFFFFFF] : ({self : (char(1))[20][{20}].(0)* | (self != 0)})) 4 | string.c:77.15-27: `str->content' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 5 | string.c:77.15-18: `str' -> ([1..0xFFFFFFFB] : ({self : Name(struct string20)[{0}].(0)* | (self != 0)})) 6 | string.c:77.30-41: `str->length' -> {20} 7 | string.c:77.30-33: `str' -> ([1..0xFFFFFFFB] : ({self : Name(struct string20)[{0}].(0)* | (self != 0)})) 8 | string.c:79.8-18: `ptr < last' -> {0; 1} 9 | string.c:79.8-11: `ptr' -> ([1..0xFFFFFFFF] : 10 | ({self : (char(1))[20][[0..0x7FFFFFFF]].(0)* | (self != 0)})) 11 | string.c:79.14-18: `last' -> ([21..0xFFFFFFFF] : ({self : (char(1))[20][{20}].(0)* | (self != 0)})) 12 | string.c:80.3-6: `ptr' -> ([1..0xFFFFFFFE] : 13 | ({self : (char(1))[20][[0..0x7FFFFFFF]].(0)* | (self != 0)})) 14 | string.c:81.2-7: `ptr + 1' -> ([1..0xFFFFFFFE] : 15 | ({self : (char(1))[20][[0..0x7FFFFFFF]].(0)* | (self != 0)})) + 0x1 16 | string.c:81.2-5: `ptr' -> ([1..0xFFFFFFFE] : 17 | ({self : (char(1))[20][[0..0x7FFFFFFF]].(0)* | (self != 0)})) 18 | Unproved regular alarms: 19 | Unproved additional alarms: 20 | Proved 4/4 regular alarms 21 | Unproved 0 regular alarms and 0 additional alarms. 22 | Solved 0/0 user assertions, proved 0 23 | -------------------------------------------------------------------------------- /tests/types/string_fill_test_wrong_string_types.cdump: -------------------------------------------------------------------------------- 1 | string.c:87.10-21: `str->length' -> [2..0x7FFFFFFF] 2 | string.c:87.10-13: `str' -> ([1..0xFFFFFFFF] : ({self : Name(string)[{0}].(0)* | (self != 0)})) 3 | string.c:88.14-26: `str->content' -> ([1..0xFFFFFFFF] : 4 | ({self : char(1)[[2..0x7FFFFFFF]][{0}].(0)* | (self != 0)})) 5 | string.c:88.14-17: `str' -> ([1..0xFFFFFFFF] : ({self : Name(string)[{0}].(0)* | (self != 0)})) 6 | string.c:90.9-14: `i < 0' -> {0x0} 7 | string.c:90.9-10: `i' -> {0; 1} 8 | string.c:90.20-26: `i == 0' -> {0; 1} 9 | string.c:90.20-21: `i' -> {0; 1} 10 | string.c:90.32-38: `i < nb' -> {0x1} 11 | string.c:90.32-33: `i' -> {0} 12 | string.c:90.36-38: `nb' -> [2..0x7FFFFFFF] 13 | string.c:91.2-5: `ptr + i' -> ([1..0xFFFFFFFF] : 14 | ({self : char(1)[[2..0x7FFFFFFF]][{0}].(0)* | (self != 0)})) 15 | string.c:91.2-5: `ptr' -> ([1..0xFFFFFFFF] : 16 | ({self : char(1)[[2..0x7FFFFFFF]][{0}].(0)* | (self != 0)})) 17 | string.c:91.6-7: `i' -> {0} 18 | string.c:92.2-5: `i + 1' -> {1} 19 | string.c:92.2-3: `i' -> {0} 20 | Unproved regular alarms: 21 | Unproved additional alarms: 22 | Proved 3/3 regular alarms 23 | Unproved 0 regular alarms and 0 additional alarms. 24 | Solved 0/0 user assertions, proved 0 25 | -------------------------------------------------------------------------------- /tests/types/string_fill_test_wrong_string_types2.cdump: -------------------------------------------------------------------------------- 1 | string.c:87.10-21: `str->length' -> {15} 2 | string.c:87.10-13: `str' -> ([1..0xFFFFFFFF] : ({self : Name(struct string15)[{0}].(0)* | (self != 0)})) 3 | string.c:88.14-26: `str->content' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 4 | string.c:88.14-17: `str' -> ([1..0xFFFFFFFF] : ({self : Name(struct string15)[{0}].(0)* | (self != 0)})) 5 | string.c:90.9-14: `i < 0' -> {0x0} 6 | string.c:90.9-10: `i' -> {0; 1} 7 | string.c:90.20-26: `i == 0' -> {0; 1} 8 | string.c:90.20-21: `i' -> {0; 1} 9 | string.c:90.32-38: `i < nb' -> {0x1} 10 | string.c:90.32-33: `i' -> {0} 11 | string.c:90.36-38: `nb' -> {15} 12 | string.c:91.2-5: `ptr + i' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 13 | string.c:91.2-5: `ptr' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 14 | string.c:91.6-7: `i' -> {0} 15 | string.c:92.2-5: `i + 1' -> {1} 16 | string.c:92.2-3: `i' -> {0} 17 | Unproved regular alarms: 18 | Unproved additional alarms: 19 | Proved 3/3 regular alarms 20 | Unproved 0 regular alarms and 0 additional alarms. 21 | Solved 0/0 user assertions, proved 0 22 | -------------------------------------------------------------------------------- /tests/types/string_fill_test_wrong_string_types3.cdump: -------------------------------------------------------------------------------- 1 | string.c:87.10-21: `str->length' -> {20} 2 | string.c:87.10-13: `str' -> ([1..0xFFFFFFFF] : ({self : Name(struct string20)[{0}].(0)* | (self != 0)})) 3 | string.c:88.14-26: `str->content' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 4 | string.c:88.14-17: `str' -> ([1..0xFFFFFFFF] : ({self : Name(struct string20)[{0}].(0)* | (self != 0)})) 5 | string.c:90.9-14: `i < 0' -> {0x0} 6 | string.c:90.9-10: `i' -> {0; 1} 7 | string.c:90.20-26: `i == 0' -> {0; 1} 8 | string.c:90.20-21: `i' -> {0; 1} 9 | string.c:90.32-38: `i < nb' -> {0x1} 10 | string.c:90.32-33: `i' -> {0} 11 | string.c:90.36-38: `nb' -> {20} 12 | string.c:91.2-5: `ptr + i' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 13 | string.c:91.2-5: `ptr' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 14 | string.c:91.6-7: `i' -> {0} 15 | string.c:92.2-5: `i + 1' -> {1} 16 | string.c:92.2-3: `i' -> {0} 17 | Unproved regular alarms: 18 | Unproved additional alarms: 19 | Proved 3/3 regular alarms 20 | Unproved 0 regular alarms and 0 additional alarms. 21 | Solved 0/0 user assertions, proved 0 22 | -------------------------------------------------------------------------------- /tests/types/string_test_access_string_types.cdump: -------------------------------------------------------------------------------- 1 | string.c:10.1-13: `str->content + 0' -> ([1..0xFFFFFFFF] : 2 | ({self : char(1)[[2..0x7FFFFFFF]][{0}].(0)* | (self != 0)})) 3 | string.c:10.1-13: `str->content' -> ([1..0xFFFFFFFF] : 4 | ({self : char(1)[[2..0x7FFFFFFF]][{0}].(0)* | (self != 0)})) 5 | string.c:10.1-4: `str' -> ([1..0xFFFFFFFF] : ({self : Name(string)[{0}].(0)* | (self != 0)})) 6 | string.c:11.19-41: `(int)*(str->content + 0) != '7'' -> {0; 1} 7 | string.c:11.19-34: `(int)*(str->content + 0)' -> [-128..127] 8 | string.c:11.19-34: `*(str->content + 0)' -> [--..--] 9 | string.c:11.19-31: `str->content + 0' -> ([1..0xFFFFFFFF] : 10 | ({self : char(1)[[2..0x7FFFFFFF]][{0}].(0)* | (self != 0)})) 11 | string.c:11.19-31: `str->content' -> ([1..0xFFFFFFFF] : 12 | ({self : char(1)[[2..0x7FFFFFFF]][{0}].(0)* | (self != 0)})) 13 | string.c:11.19-22: `str' -> ([1..0xFFFFFFFB] : ({self : Name(string)[{0}].(0)* | (self != 0)})) 14 | Unproved regular alarms: 15 | Unproved additional alarms: 16 | Proved 4/4 regular alarms 17 | Unproved 0 regular alarms and 0 additional alarms. 18 | string.c:11: assertion is FALSE (counter-example exists) (proved with smt solving) 19 | Solved 1/1 user assertions, proved 0 20 | -------------------------------------------------------------------------------- /tests/types/string_test_access_string_types2.cdump: -------------------------------------------------------------------------------- 1 | string.c:10.1-13: `str->content + 0' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 2 | string.c:10.1-13: `str->content' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 3 | string.c:10.1-4: `str' -> ([1..0xFFFFFFFF] : ({self : Name(struct string15)[{0}].(0)* | (self != 0)})) 4 | string.c:11.19-41: `(int)*(str->content + 0) != '7'' -> {0x1} 5 | string.c:11.19-34: `(int)*(str->content + 0)' -> {48} 6 | string.c:11.19-34: `*(str->content + 0)' -> {48} 7 | string.c:11.19-31: `str->content + 0' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 8 | string.c:11.19-31: `str->content' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 9 | string.c:11.19-22: `str' -> ([1..0xFFFFFFFB] : ({self : Name(struct string15)[{0}].(0)* | (self != 0)})) 10 | Unproved regular alarms: 11 | Unproved additional alarms: 12 | Proved 4/4 regular alarms 13 | Unproved 0 regular alarms and 0 additional alarms. 14 | string.c:11: assertion is TRUE (valid) (proved with abstract interpretation) 15 | Solved 1/1 user assertions, proved 1 16 | -------------------------------------------------------------------------------- /tests/types/string_test_access_string_types3.cdump: -------------------------------------------------------------------------------- 1 | string.c:10.1-13: `str->content + 0' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 2 | string.c:10.1-13: `str->content' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 3 | string.c:10.1-4: `str' -> ([1..0xFFFFFFFF] : ({self : Name(struct string20)[{0}].(0)* | (self != 0)})) 4 | string.c:11.19-41: `(int)*(str->content + 0) != '7'' -> {0x1} 5 | string.c:11.19-34: `(int)*(str->content + 0)' -> {48} 6 | string.c:11.19-34: `*(str->content + 0)' -> {48} 7 | string.c:11.19-31: `str->content + 0' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 8 | string.c:11.19-31: `str->content' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 9 | string.c:11.19-22: `str' -> ([1..0xFFFFFFFB] : ({self : Name(struct string20)[{0}].(0)* | (self != 0)})) 10 | Unproved regular alarms: 11 | Unproved additional alarms: 12 | Proved 4/4 regular alarms 13 | Unproved 0 regular alarms and 0 additional alarms. 14 | string.c:11: assertion is TRUE (valid) (proved with abstract interpretation) 15 | Solved 1/1 user assertions, proved 1 16 | -------------------------------------------------------------------------------- /tests/types/string_types.c: -------------------------------------------------------------------------------- 1 | type string = ∃ a : (int with self > 1) .struct { 2 | (int with self = a) length ; 3 | (char[a])+ content ; 4 | } 5 | 6 | void test_access(string+ str); 7 | void zeros(string+ str); 8 | 9 | void zeros2(string+ str); 10 | void zeros3(string+ str); 11 | void zeros4(string+ str); 12 | void zeros5(string+ str); 13 | 14 | void fill_test(string+ str); 15 | void fill_test_wrong(string+ str); 16 | -------------------------------------------------------------------------------- /tests/types/string_types2.c: -------------------------------------------------------------------------------- 1 | struct string15 { 2 | (int with self = 15) length ; 3 | (char[20])+ content ; 4 | }; 5 | 6 | void test_access(struct string15+ str); 7 | void zeros(struct string15+ str); 8 | 9 | void fill_test(struct string15+ str); 10 | void fill_test_wrong(struct string15+ str); 11 | -------------------------------------------------------------------------------- /tests/types/string_types3.c: -------------------------------------------------------------------------------- 1 | struct string20 { 2 | (int with self = 20) length ; 3 | (char[20])+ content ; 4 | }; 5 | 6 | void test_access(struct string20+ str); 7 | void zeros(struct string20+ str); 8 | 9 | void fill_test(struct string20+ str); 10 | void fill_test_wrong(struct string20+ str); 11 | -------------------------------------------------------------------------------- /tests/types/string_zeros2_string_types.cdump: -------------------------------------------------------------------------------- 1 | string.c:27.14-26: `(int *)str->content' -> ([1..0xFFFFFFFF] : 2 | ({self : char(1)[[2..0x7FFFFFFF]][{0}].(0)* | (self != 0)})) 3 | string.c:27.14-26: `str->content' -> ([1..0xFFFFFFFF] : 4 | ({self : char(1)[[2..0x7FFFFFFF]][{0}].(0)* | (self != 0)})) 5 | string.c:27.14-17: `str' -> ([1..0xFFFFFFFF] : ({self : Name(string)[{0}].(0)* | (self != 0)})) 6 | string.c:29.14-25: `str->length' -> [2..0x7FFFFFFF] 7 | string.c:29.14-17: `str' -> ([1..0xFFFFFFFB] : ({self : Name(string)[{0}].(0)* | (self != 0)})) 8 | string.c:30.17-27: `i < length' -> {0; 1} 9 | string.c:30.17-18: `i' -> [0..0x7FFFFFFF] 10 | string.c:30.21-27: `length' -> [2..0x7FFFFFFF] 11 | string.c:31.4-12: `init + i' -> ([1..0xFFFFFFFF] : 12 | ({self : char(1)[[2..0x7FFFFFFF]][[-0x80000000..0x7FFFFFFC],0%4].(0)* | 13 | (self != 0)})) 14 | string.c:31.4-8: `init' -> ([1..0xFFFFFFFF] : 15 | ({self : char(1)[[2..0x7FFFFFFF]][{0}].(0)* | (self != 0)})) 16 | string.c:31.11-12: `i' -> [0..0x7FFFFFFE] 17 | string.c:30.29-32: `i + 1' -> [1..0x7FFFFFFF] 18 | string.c:30.29-30: `i' -> [0..0x7FFFFFFE] 19 | Unproved regular alarms: 20 | Unproved additional alarms: 21 | + string.c:31 : { *(init + i) = '0'; } -> store_param_nonptr ; 22 | Proved 3/3 regular alarms 23 | Unproved 0 regular alarms and 1 additional alarms. 24 | Solved 0/0 user assertions, proved 0 25 | -------------------------------------------------------------------------------- /tests/types/string_zeros2_string_types2.cdump: -------------------------------------------------------------------------------- 1 | string.c:27.14-26: `(int *)str->content' -> {0} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 2 | string.c:27.14-26: `str->content' -> {0} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 3 | string.c:27.14-17: `str' -> {0} or ([1..0xFFFFFFFF] : (Name(struct string))[{0}].0*) 4 | string.c:29.14-25: `str->length' -> [--..--] 5 | string.c:29.14-17: `str' -> ([1..0xFFFFFFFB] : (Name(struct string))[{0}].0*) 6 | string.c:30.17-27: `i < length' -> {0; 1} 7 | string.c:30.17-18: `i' -> {0} 8 | string.c:30.21-27: `length' -> [--..--] 9 | string.c:31.4-12: `init + i' -> {0} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 10 | string.c:31.4-8: `init' -> {0} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 11 | string.c:31.11-12: `i' -> {0} 12 | Unproved regular alarms: 13 | string.c:27: Memory_access(str->content, read) {true;false} 14 | string.c:31: Memory_access(*(init + i), write) {true;false} 15 | Unproved additional alarms: 16 | + string.c:31 : { *(init + i) = '0'; } -> array_offset_access ; 17 | Proved 1/3 regular alarms 18 | Unproved 2 regular alarms and 1 additional alarms. 19 | Solved 0/0 user assertions, proved 0 20 | -------------------------------------------------------------------------------- /tests/types/string_zeros2_string_types3.cdump: -------------------------------------------------------------------------------- 1 | string.c:27.14-26: `(int *)str->content' -> {0} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 2 | string.c:27.14-26: `str->content' -> {0} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 3 | string.c:27.14-17: `str' -> {0} or ([1..0xFFFFFFFF] : (Name(struct string))[{0}].0*) 4 | string.c:29.14-25: `str->length' -> [--..--] 5 | string.c:29.14-17: `str' -> ([1..0xFFFFFFFB] : (Name(struct string))[{0}].0*) 6 | string.c:30.17-27: `i < length' -> {0; 1} 7 | string.c:30.17-18: `i' -> {0} 8 | string.c:30.21-27: `length' -> [--..--] 9 | string.c:31.4-12: `init + i' -> {0} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 10 | string.c:31.4-8: `init' -> {0} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 11 | string.c:31.11-12: `i' -> {0} 12 | Unproved regular alarms: 13 | string.c:27: Memory_access(str->content, read) {true;false} 14 | string.c:31: Memory_access(*(init + i), write) {true;false} 15 | Unproved additional alarms: 16 | + string.c:31 : { *(init + i) = '0'; } -> array_offset_access ; 17 | Proved 1/3 regular alarms 18 | Unproved 2 regular alarms and 1 additional alarms. 19 | Solved 0/0 user assertions, proved 0 20 | -------------------------------------------------------------------------------- /tests/types/string_zeros4_string_types2.cdump: -------------------------------------------------------------------------------- 1 | string.c:50.14-26: `str->content' -> {0} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 2 | string.c:50.14-17: `str' -> {0} or ([1..0xFFFFFFFF] : (Name(struct string))[{0}].0*) 3 | string.c:51.15-18: `ptr' -> {0} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 4 | string.c:52.14-25: `str->length' -> [--..--] 5 | string.c:52.14-17: `str' -> ([1..0xFFFFFFFB] : (Name(struct string))[{0}].0*) 6 | string.c:53.17-27: `i < length' -> {0; 1} 7 | string.c:53.17-18: `i' -> [0..0x7FFFFFFF] 8 | string.c:53.21-27: `length' -> [--..--] 9 | string.c:54.21-38: `init + i == ptr' -> {0; 1} 10 | string.c:54.22-30: `init + i' -> [0..0x7FFFFFFE] or ([1..0xFFFFFFFF] : 11 | (anyIntegerType(1))[{0}].0* + [0..0x7FFFFFFE]) 12 | string.c:54.22-26: `init' -> {0} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 13 | string.c:54.29-30: `i' -> [0..0x7FFFFFFE] 14 | string.c:54.35-38: `ptr' -> {0; 49} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 15 | string.c:56.2-7: `ptr + 1' -> {48} + 0x1 16 | string.c:56.2-5: `ptr' -> {48} 17 | string.c:53.29-32: `i + 1' -> [1..0x7FFFFFFF] 18 | string.c:53.29-30: `i' -> [0..0x7FFFFFFE] 19 | Unproved regular alarms: 20 | string.c:50: Memory_access(str->content, read) {true;false} 21 | Unproved additional alarms: 22 | Proved 1/2 regular alarms 23 | Unproved 1 regular alarms and 0 additional alarms. 24 | string.c:54: assertion is FALSE (counter-example exists) (proved with smt solving) 25 | Solved 1/1 user assertions, proved 0 26 | -------------------------------------------------------------------------------- /tests/types/string_zeros4_string_types3.cdump: -------------------------------------------------------------------------------- 1 | string.c:50.14-26: `str->content' -> {0} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 2 | string.c:50.14-17: `str' -> {0} or ([1..0xFFFFFFFF] : (Name(struct string))[{0}].0*) 3 | string.c:51.15-18: `ptr' -> {0} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 4 | string.c:52.14-25: `str->length' -> [--..--] 5 | string.c:52.14-17: `str' -> ([1..0xFFFFFFFB] : (Name(struct string))[{0}].0*) 6 | string.c:53.17-27: `i < length' -> {0; 1} 7 | string.c:53.17-18: `i' -> [0..0x7FFFFFFF] 8 | string.c:53.21-27: `length' -> [--..--] 9 | string.c:54.21-38: `init + i == ptr' -> {0; 1} 10 | string.c:54.22-30: `init + i' -> [0..0x7FFFFFFE] or ([1..0xFFFFFFFF] : 11 | (anyIntegerType(1))[{0}].0* + [0..0x7FFFFFFE]) 12 | string.c:54.22-26: `init' -> {0} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 13 | string.c:54.29-30: `i' -> [0..0x7FFFFFFE] 14 | string.c:54.35-38: `ptr' -> {0; 49} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 15 | string.c:56.2-7: `ptr + 1' -> {48} + 0x1 16 | string.c:56.2-5: `ptr' -> {48} 17 | string.c:53.29-32: `i + 1' -> [1..0x7FFFFFFF] 18 | string.c:53.29-30: `i' -> [0..0x7FFFFFFE] 19 | Unproved regular alarms: 20 | string.c:50: Memory_access(str->content, read) {true;false} 21 | Unproved additional alarms: 22 | Proved 1/2 regular alarms 23 | Unproved 1 regular alarms and 0 additional alarms. 24 | string.c:54: assertion is FALSE (counter-example exists) (proved with smt solving) 25 | Solved 1/1 user assertions, proved 0 26 | -------------------------------------------------------------------------------- /tests/types/string_zeros5_string_types.cdump: -------------------------------------------------------------------------------- 1 | string.c:61.14-26: `str->content' -> ([1..0xFFFFFFFF] : 2 | ({self : char(1)[[2..0x7FFFFFFF]][{0}].(0)* | (self != 0)})) 3 | string.c:61.14-17: `str' -> ([1..0xFFFFFFFF] : ({self : Name(string)[{0}].(0)* | (self != 0)})) 4 | string.c:63.8-23: `i < str->length' -> {0; 1} 5 | string.c:63.8-9: `i' -> [0..0x7FFFFFFF] 6 | string.c:63.12-23: `str->length' -> [2..0x7FFFFFFF] 7 | string.c:63.12-15: `str' -> ([1..0xFFFFFFFB] : ({self : Name(string)[{0}].(0)* | (self != 0)})) 8 | string.c:64.2-5: `ptr + i' -> ([1..0xFFFFFFFF] : 9 | ({self : char(1)[[2..0x7FFFFFFF]][[0..0x7FFFFFFE]].(0)* | (self != 0)})) 10 | string.c:64.2-5: `ptr' -> ([1..0xFFFFFFFF] : 11 | ({self : char(1)[[2..0x7FFFFFFF]][{0}].(0)* | (self != 0)})) 12 | string.c:64.6-7: `i' -> [0..0x7FFFFFFE] 13 | string.c:65.2-5: `i + 1' -> [1..0x7FFFFFFF] 14 | string.c:65.2-3: `i' -> [0..0x7FFFFFFE] 15 | Unproved regular alarms: 16 | Unproved additional alarms: 17 | + string.c:64 : { *(ptr + i) = (char)'0'; } -> array_offset_access ; 18 | Proved 3/3 regular alarms 19 | Unproved 0 regular alarms and 1 additional alarms. 20 | Solved 0/0 user assertions, proved 0 21 | -------------------------------------------------------------------------------- /tests/types/string_zeros5_string_types2.cdump: -------------------------------------------------------------------------------- 1 | string.c:61.14-26: `str->content' -> {0} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 2 | string.c:61.14-17: `str' -> {0} or ([1..0xFFFFFFFF] : (Name(struct string))[{0}].0*) 3 | string.c:63.8-23: `i < str->length' -> {0; 1} 4 | string.c:63.8-9: `i' -> [0..0x7FFFFFFF] 5 | string.c:63.12-23: `str->length' -> [--..--] 6 | string.c:63.12-15: `str' -> ([1..0xFFFFFFFB] : (Name(struct string))[{0}].0*) 7 | string.c:64.2-5: `ptr + i' -> [0..0x7FFFFFFE] or ([1..0xFFFFFFFF] : 8 | (anyIntegerType(1))[{0}].0* + [0..0x7FFFFFFE]) 9 | string.c:64.2-5: `ptr' -> {0} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 10 | string.c:64.6-7: `i' -> [0..0x7FFFFFFE] 11 | string.c:65.2-5: `i + 1' -> [1..0x7FFFFFFF] 12 | string.c:65.2-3: `i' -> [0..0x7FFFFFFE] 13 | Unproved regular alarms: 14 | string.c:61: Memory_access(str->content, read) {true;false} 15 | string.c:64: Memory_access(*(ptr + i), write) {true;false} 16 | Unproved additional alarms: 17 | + string.c:64 : { *(ptr + i) = (char)'0'; } -> store_param_nonptr ; 18 | Proved 1/3 regular alarms 19 | Unproved 2 regular alarms and 1 additional alarms. 20 | Solved 0/0 user assertions, proved 0 21 | -------------------------------------------------------------------------------- /tests/types/string_zeros5_string_types3.cdump: -------------------------------------------------------------------------------- 1 | string.c:61.14-26: `str->content' -> {0} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 2 | string.c:61.14-17: `str' -> {0} or ([1..0xFFFFFFFF] : (Name(struct string))[{0}].0*) 3 | string.c:63.8-23: `i < str->length' -> {0; 1} 4 | string.c:63.8-9: `i' -> [0..0x7FFFFFFF] 5 | string.c:63.12-23: `str->length' -> [--..--] 6 | string.c:63.12-15: `str' -> ([1..0xFFFFFFFB] : (Name(struct string))[{0}].0*) 7 | string.c:64.2-5: `ptr + i' -> [0..0x7FFFFFFE] or ([1..0xFFFFFFFF] : 8 | (anyIntegerType(1))[{0}].0* + [0..0x7FFFFFFE]) 9 | string.c:64.2-5: `ptr' -> {0} or ([1..0xFFFFFFFF] : (anyIntegerType(1))[{0}].0*) 10 | string.c:64.6-7: `i' -> [0..0x7FFFFFFE] 11 | string.c:65.2-5: `i + 1' -> [1..0x7FFFFFFF] 12 | string.c:65.2-3: `i' -> [0..0x7FFFFFFE] 13 | Unproved regular alarms: 14 | string.c:61: Memory_access(str->content, read) {true;false} 15 | string.c:64: Memory_access(*(ptr + i), write) {true;false} 16 | Unproved additional alarms: 17 | + string.c:64 : { *(ptr + i) = (char)'0'; } -> store_param_nonptr ; 18 | Proved 1/3 regular alarms 19 | Unproved 2 regular alarms and 1 additional alarms. 20 | Solved 0/0 user assertions, proved 0 21 | -------------------------------------------------------------------------------- /tests/types/string_zeros_string_types2.cdump: -------------------------------------------------------------------------------- 1 | string.c:17.14-26: `str->content' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 2 | string.c:17.14-17: `str' -> ([1..0xFFFFFFFF] : ({self : Name(struct string15)[{0}].(0)* | (self != 0)})) 3 | string.c:18.8-40: `ptr < str->content + str->length' -> {0; 1} 4 | string.c:18.8-11: `ptr' -> ([1..0xFFFFFFFF] : 5 | ({self : (char(1))[20][[0..0x7FFFFFED]].(0)* | (self != 0)})) 6 | string.c:18.14-40: `str->content + str->length' -> ([16..0xFFFFFFFF] : ({self : (char(1))[20][{15}].(0)* | (self != 0)})) 7 | string.c:18.14-26: `str->content' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 8 | string.c:18.14-17: `str' -> ([1..0xFFFFFFFB] : ({self : Name(struct string15)[{0}].(0)* | (self != 0)})) 9 | string.c:18.29-40: `str->length' -> {15} 10 | string.c:18.29-32: `str' -> ([1..0xFFFFFFFB] : ({self : Name(struct string15)[{0}].(0)* | (self != 0)})) 11 | string.c:19.3-6: `ptr' -> ([1..0xFFFFFFFE] : 12 | ({self : (char(1))[20][[0..0x7FFFFFED]].(0)* | (self != 0)})) 13 | string.c:20.8-15: `ptr + 1' -> ([1..0xFFFFFFFE] : 14 | ({self : (char(1))[20][[0..0x7FFFFFEC]].(0)* | (self != 0)})) + 0x1 15 | string.c:20.8-11: `ptr' -> ([1..0xFFFFFFFE] : 16 | ({self : (char(1))[20][[0..0x7FFFFFEC]].(0)* | (self != 0)})) 17 | Unproved regular alarms: 18 | Unproved additional alarms: 19 | Proved 4/4 regular alarms 20 | Unproved 0 regular alarms and 0 additional alarms. 21 | Solved 0/0 user assertions, proved 0 22 | -------------------------------------------------------------------------------- /tests/types/string_zeros_string_types3.cdump: -------------------------------------------------------------------------------- 1 | string.c:17.14-26: `str->content' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 2 | string.c:17.14-17: `str' -> ([1..0xFFFFFFFF] : ({self : Name(struct string20)[{0}].(0)* | (self != 0)})) 3 | string.c:18.8-40: `ptr < str->content + str->length' -> {0; 1} 4 | string.c:18.8-11: `ptr' -> ([1..0xFFFFFFFF] : 5 | ({self : (char(1))[20][[0..0x7FFFFFED]].(0)* | (self != 0)})) 6 | string.c:18.14-40: `str->content + str->length' -> ([21..0xFFFFFFFF] : ({self : (char(1))[20][{20}].(0)* | (self != 0)})) 7 | string.c:18.14-26: `str->content' -> ([1..0xFFFFFFFF] : ({self : (char(1))[20][{0}].(0)* | (self != 0)})) 8 | string.c:18.14-17: `str' -> ([1..0xFFFFFFFB] : ({self : Name(struct string20)[{0}].(0)* | (self != 0)})) 9 | string.c:18.29-40: `str->length' -> {20} 10 | string.c:18.29-32: `str' -> ([1..0xFFFFFFFB] : ({self : Name(struct string20)[{0}].(0)* | (self != 0)})) 11 | string.c:19.3-6: `ptr' -> ([1..0xFFFFFFFE] : 12 | ({self : (char(1))[20][[0..0x7FFFFFED]].(0)* | (self != 0)})) 13 | string.c:20.8-15: `ptr + 1' -> ([1..0xFFFFFFFE] : 14 | ({self : (char(1))[20][[0..0x7FFFFFEC]].(0)* | (self != 0)})) + 0x1 15 | string.c:20.8-11: `ptr' -> ([1..0xFFFFFFFE] : 16 | ({self : (char(1))[20][[0..0x7FFFFFEC]].(0)* | (self != 0)})) 17 | Unproved regular alarms: 18 | Unproved additional alarms: 19 | Proved 4/4 regular alarms 20 | Unproved 0 regular alarms and 0 additional alarms. 21 | Solved 0/0 user assertions, proved 0 22 | -------------------------------------------------------------------------------- /tests/types/test_cache.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct pair { 4 | int a ; 5 | int b ; 6 | }; 7 | 8 | struct list { 9 | int data ; 10 | struct list * next ; 11 | }; 12 | 13 | struct pair * alloc_pair() { 14 | struct pair * p = malloc(sizeof(struct pair)); 15 | if (__VERIFIER_nondet_int()) { 16 | p->a = 3 ; 17 | p->b = 1 ; 18 | } else { 19 | p->a = 2 ; 20 | p->b = 5 ; 21 | } 22 | return p ; 23 | } 24 | 25 | struct list * alloc_list() { 26 | struct list * l = malloc(sizeof(struct list)); 27 | l->data = 0 ; 28 | l->next = NULL ; 29 | if (__VERIFIER_nondet_int()) { 30 | l->data = 11 ; 31 | l->next = alloc_list() ; 32 | } 33 | return l ; 34 | } 35 | 36 | int test_pair(struct pair * p) { 37 | if (__VERIFIER_nondet_int()) { 38 | p->a = 3 ; 39 | } else { 40 | p->a = 2 ; 41 | } 42 | return p->a ; 43 | } 44 | 45 | void main() {} 46 | -------------------------------------------------------------------------------- /tests/types/test_cache_alloc_list_test_cache_types.cdump: -------------------------------------------------------------------------------- 1 | test_cache.c:27.2-3: `l' -> ([1..0xFFFFFFFF] : ({self : Name(struct list)[{0}].(0)* | (self != 0)})) 2 | test_cache.c:28.2-3: `l' -> ([1..0xFFFFFFFF] : ({self : Name(struct list)[{0}].(0)* | (self != 0)})) 3 | test_cache.c:29.6-29: `tmp_0' -> [--..--] 4 | test_cache.c:30.4-5: `l' -> ([1..0xFFFFFFFB] : ({self : Name(struct list)[{0}].(0)* | (self != 0)})) 5 | test_cache.c:31.4-5: `l' -> ([1..0xFFFFFFFB] : ({self : Name(struct list)[{0}].(0)* | (self != 0)})) 6 | test_cache.c:33.9-10: `l' -> ([1..0xFFFFFFFB] : ({self : Name(struct list)[{0}].(0)* | (self != 0)})) 7 | Unproved regular alarms: 8 | Unproved additional alarms: 9 | Proved 4/4 regular alarms 10 | Unproved 0 regular alarms and 0 additional alarms. 11 | Solved 0/0 user assertions, proved 0 12 | -------------------------------------------------------------------------------- /tests/types/test_cache_alloc_pair_test_cache_types.cdump: -------------------------------------------------------------------------------- 1 | test_cache.c:15.6-29: `tmp_0' -> [--..--] 2 | test_cache.c:16.4-5: `p' -> ([1..0xFFFFFFFF] : ({self : Name(struct pair)[{0}].(0)* | (self != 0)})) 3 | test_cache.c:17.1-2: `p' -> ([1..0xFFFFFFFF] : ({self : Name(struct pair)[{0}].(0)* | (self != 0)})) 4 | test_cache.c:19.1-2: `p' -> ([1..0xFFFFFFFF] : ({self : Name(struct pair)[{0}].(0)* | (self != 0)})) 5 | test_cache.c:20.1-2: `p' -> ([1..0xFFFFFFFF] : ({self : Name(struct pair)[{0}].(0)* | (self != 0)})) 6 | test_cache.c:22.9-10: `p' -> ([1..0xFFFFFFFB] : ({self : Name(struct pair)[{0}].(0)* | (self != 0)})) 7 | Unproved regular alarms: 8 | Unproved additional alarms: 9 | Proved 4/4 regular alarms 10 | Unproved 0 regular alarms and 0 additional alarms. 11 | Solved 0/0 user assertions, proved 0 12 | -------------------------------------------------------------------------------- /tests/types/test_cache_test_pair_test_cache_types.cdump: -------------------------------------------------------------------------------- 1 | test_cache.c:37.6-29: `tmp' -> [--..--] 2 | test_cache.c:38.4-5: `p' -> ([1..0xFFFFFFFF] : ({self : Name(struct pair)[{0}].(0)* | (self != 0)})) 3 | test_cache.c:40.1-2: `p' -> ([1..0xFFFFFFFF] : ({self : Name(struct pair)[{0}].(0)* | (self != 0)})) 4 | test_cache.c:42.9-13: `p->a' -> [--..--] 5 | test_cache.c:42.9-10: `p' -> ([1..0xFFFFFFFF] : ({self : Name(struct pair)[{0}].(0)* | (self != 0)})) 6 | test_cache.c:42.2-15: `__retres' -> [--..--] 7 | Unproved regular alarms: 8 | Unproved additional alarms: 9 | + Return -> typing_store ; 10 | Proved 3/3 regular alarms 11 | Unproved 0 regular alarms and 1 additional alarms. 12 | Solved 0/0 user assertions, proved 0 13 | -------------------------------------------------------------------------------- /tests/types/test_cache_types.c: -------------------------------------------------------------------------------- 1 | struct pair { 2 | int a ; 3 | int b ; 4 | }; 5 | 6 | struct list { 7 | int a ; 8 | struct list * next ; 9 | }; 10 | 11 | struct list + alloc_list() ; 12 | struct pair + alloc_pair() ; 13 | 14 | ((int with self > 1) with self < 4) test_pair(struct pair + p); 15 | -------------------------------------------------------------------------------- /tests/types/test_comp.c: -------------------------------------------------------------------------------- 1 | #include "binsec-stubs.h" 2 | 3 | void test_ge(int * a, int * b) { 4 | int i = *a ; 5 | int j = *b ; 6 | if (i >= j) { 7 | __VERIFIER_assert (i >= j) ; 8 | } 9 | } 10 | 11 | void test_lt20(int * num) { 12 | int i = *num ; 13 | if (i < 20) { 14 | __VERIFIER_assert (i < 20) ; 15 | } 16 | } 17 | 18 | void test_gt(int * a, int * b) { 19 | int i = *a ; 20 | int j = *b ; 21 | if (i > j) { 22 | __VERIFIER_assert (i > j) ; 23 | } else { __VERIFIER_assert (i <= j) ; } 24 | } 25 | 26 | void test_gt20(int * num) { 27 | int i = *num ; 28 | if (i > 20) { 29 | __VERIFIER_assert (i > 20) ; 30 | } 31 | } 32 | 33 | void test_le(int * a, int * b) { 34 | int i = *a ; 35 | int j = *b ; 36 | if (i <= j) { 37 | __VERIFIER_assert (i <= j) ; 38 | } else { __VERIFIER_assert (i > j) ; } 39 | } 40 | 41 | void test_le20(int * num) { 42 | int i = *num ; 43 | if (i <= 20) { 44 | __VERIFIER_assert (i <= 20) ; 45 | } 46 | } 47 | 48 | void test_lt0(int * num) { 49 | int n = (*a) ; 50 | if (0 < n) __VERIFIER_assert (0 < n) ; 51 | else __VERIFIER_assert (0 >= n) ; 52 | } 53 | 54 | void main() {} 55 | -------------------------------------------------------------------------------- /tests/types/test_comp_types.c: -------------------------------------------------------------------------------- 1 | type int1 = int with self = 1 2 | type int2 = int with self = 2 3 | type int3 = int with self = 3 4 | 5 | type app1 = int with self = a 6 | type app2 = int with self = b 7 | type app3 = (int with self = (a + b)) 8 | type app4 = (int with self = b) 9 | 10 | type alist = struct { 11 | (int with self = a) data ; 12 | alist(a)? next ; 13 | } 14 | 15 | type list5 = struct { 16 | (int with self = 5) data ; 17 | alist? next ; 18 | } 19 | 20 | type foo1 = ∃ a . (int with self = a) 21 | type foo2 = ∃ b . (int with self = b) 22 | 23 | type pair = struct { 24 | int x ; 25 | int y ; 26 | } 27 | 28 | type pairEq = ∃ a . struct { 29 | (int with self = a) x ; 30 | (int with self = a) y ; 31 | } 32 | 33 | type pairOfPair = struct { 34 | pairEq+ u ; 35 | pairEq+ v ; 36 | } 37 | 38 | type pair13_25 = struct { 39 | (int with self = 13) x ; 40 | (int with self = 25) y ; 41 | 42 | } 43 | 44 | type pairEq_ptr = ∃ a . (struct { 45 | (int with self = a) x ; 46 | (int with self = a) y ; 47 | }+) 48 | 49 | type pair13_25_ptr = (struct { 50 | (int with self = 13) x ; 51 | (int with self = 25) y ; 52 | 53 | })+ 54 | 55 | 56 | type array_n20 = struct { 57 | (int with self = 20) length ; 58 | (char[20])+ content ; 59 | } 60 | 61 | type array_n15 = struct { 62 | (int with self = 15) length ; 63 | (char[20])+ content ; 64 | } 65 | 66 | type int_pos = int with self > 1 67 | 68 | type string = ∃ a . struct { 69 | (int_pos with self = a) length ; 70 | (char[a])+ content ; 71 | } 72 | -------------------------------------------------------------------------------- /tests/types/test_loop_cond.c: -------------------------------------------------------------------------------- 1 | void test(int * ptr) { 2 | int i = 0 ; 3 | while (i < -1) { 4 | __VERIFIER_assert(i < -1) ; 5 | i++ ; 6 | } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /tests/types/test_loop_cond_types.c: -------------------------------------------------------------------------------- 1 | void test_ge(int * a, int * b); 2 | 3 | void test_lt20(int * num); 4 | 5 | void test_gt(int * a, int * b); 6 | 7 | void test_gt20(int * num); 8 | 9 | void test_le(int * a, int * b); 10 | 11 | void test_le20(int * num); 12 | 13 | void test_lt0(int * num); 14 | -------------------------------------------------------------------------------- /tests/types/variant.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | typedef struct expr { 4 | int tag ; 5 | union { 6 | int constant ; 7 | struct { struct expr * a ; struct expr * b ; } sum ; 8 | } data ; 9 | } expr ; 10 | 11 | void test(struct expr * e) { 12 | if (e->tag == 0) { 13 | __VERIFIER_assert(e->tag == 0) ; 14 | __VERIFIER_assert(e->data.constant < 1000) ; 15 | } 16 | else { 17 | __VERIFIER_assert(e->tag != 0) ; 18 | expr * a = e->data.sum.a ; 19 | expr * b = e->data.sum.b ; 20 | //__VERIFIER_assert (a->tag >= 0) ; 21 | //__VERIFIER_assert (b->tag >= 0) ; 22 | __VERIFIER_assert (0 < a) ; 23 | __VERIFIER_assert (0 < b) ; 24 | } 25 | } 26 | 27 | int main(void) { 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /tests/types/variant1.c: -------------------------------------------------------------------------------- 1 | #include "binsec-stubs.h" 2 | 3 | typedef struct expr { 4 | int tag ; 5 | union { 6 | int constant ; 7 | struct { struct expr * a ; struct expr * b ; } sum ; 8 | } data ; 9 | } expr ; 10 | 11 | void test(struct expr * e) { 12 | if (e->tag == 0) { 13 | __VERIFIER_assert(e->tag == 0) ; 14 | __VERIFIER_assert(e->data.constant < 1000) ; 15 | } 16 | else { 17 | __VERIFIER_assert(e->tag != 0) ; 18 | expr * a = e->data.sum.a ; 19 | expr * b = e->data.sum.b ; 20 | //__VERIFIER_assert (a->tag >= 0) ; 21 | //__VERIFIER_assert (b->tag >= 0) ; 22 | __VERIFIER_assert (0 < a) ; 23 | __VERIFIER_assert (0 < b) ; 24 | } 25 | } 26 | 27 | int main(void) { 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /tests/types/variant1V1_types.c: -------------------------------------------------------------------------------- 1 | type nat = int with self >= 0 2 | 3 | type expr = ∃ a : (nat with self < 2) . expr_t(a)+ 4 | 5 | type expr_t = struct { 6 | int with (self = a) tag ; 7 | union { 8 | (struct { int with self < 1000 val ; int with self = 0 padding ; }) with (a = 0) constant ; 9 | (struct { expr a ; expr b ; }) with (a != 0) sum ; 10 | } data ; 11 | } 12 | 13 | void test(expr e); 14 | 15 | -------------------------------------------------------------------------------- /tests/types/variant1V2_types.c: -------------------------------------------------------------------------------- 1 | type expr = ∃ a : (nat with self < 2) . (struct { 2 | int with (self = a) tag ; 3 | union { 4 | (int with (self = 100)) with (a = 0) a ; 5 | (int with (self = 200)) with (a != 0) b ; 6 | } data ; 7 | })+ 8 | 9 | void test(expr e); 10 | 11 | -------------------------------------------------------------------------------- /tests/types/variant1V3_types.c: -------------------------------------------------------------------------------- 1 | type bad_expr = struct { 2 | int tag ; 3 | int with (self = 100) data ; 4 | }+ 5 | 6 | void test(bad_expr e); 7 | -------------------------------------------------------------------------------- /tests/types/variant2.c: -------------------------------------------------------------------------------- 1 | // 2 | 3 | union Lisp_object_union { 4 | void * list ; 5 | int other ; 6 | }; 7 | 8 | void test(int ptr) { 9 | __VERIFIER_debug_int32((int) ptr) ; 10 | int tag = ptr & 7 ; 11 | int pointer = ptr & (~7) ; 12 | __VERIFIER_assert(((int) tag) < 8) ; 13 | __VERIFIER_assert(((int) pointer) != 0) ; 14 | } 15 | 16 | void main() {} 17 | -------------------------------------------------------------------------------- /tests/types/variant2_test_variant2_types.cdump: -------------------------------------------------------------------------------- 1 | variant2.c:9.31-34: `ptr' -> [--..--] 2 | variant2.c:10.12-19: `ptr & 7' -> {0; 1; 2; 3; 4; 5; 6; 7} 3 | variant2.c:10.12-15: `ptr' -> [--..--] 4 | variant2.c:11.16-26: `ptr & ~ 7' -> [-0x80000000..0x7FFFFFF8],0%8 5 | variant2.c:11.16-19: `ptr' -> [--..--] 6 | variant2.c:12.20-35: `tag < 8' -> {0x1} 7 | variant2.c:12.27-30: `tag' -> {0; 1; 2; 3; 4; 5; 6; 7} 8 | variant2.c:13.20-40: `pointer != 0' -> {0; 1} 9 | variant2.c:13.27-34: `pointer' -> [-0x80000000..0x7FFFFFF8],0%8 10 | Unproved regular alarms: 11 | Unproved additional alarms: 12 | Proved 0/0 regular alarms 13 | Unproved 0 regular alarms and 0 additional alarms. 14 | variant2.c:12: assertion is TRUE (valid) (proved with abstract interpretation) 15 | variant2.c:13: assertion is FALSE (counter-example exists) (proved with smt solving) 16 | Solved 2/2 user assertions, proved 1 17 | -------------------------------------------------------------------------------- /tests/types/variant2_types.c: -------------------------------------------------------------------------------- 1 | type nat = int with self >= 0 2 | 3 | type Lisp_object_union = union { 4 | Lisp_Cons+ with (a = 3) list ; 5 | int with (a != 3) other ; 6 | } 7 | 8 | type Lisp_Object = ∃ a : (nat with (self < 8)). ∃ p : Lisp_object_union(a) with ((self & 7) = 0) . (int with (self = (p | a))) 9 | 10 | type Lisp_Cons = struct { 11 | Lisp_Object car; 12 | union { 13 | Lisp_Object cdr; 14 | Lisp_Cons? chain; 15 | } u; 16 | } 17 | 18 | void test(List_Object ptr); 19 | -------------------------------------------------------------------------------- /tests/types/variant3.c: -------------------------------------------------------------------------------- 1 | //#include "binsec-stubs.h" 2 | 3 | union Lisp_object_union { 4 | void * list ; 5 | int other ; 6 | }; 7 | 8 | void test(int ptr) { 9 | __VERIFIER_debug_int32((int) ptr) ; 10 | int tag = ptr & 7 ; 11 | int pointer = ptr & (~7) ; 12 | __VERIFIER_assert(((int) tag) < 8) ; 13 | __VERIFIER_assert(((int) pointer) != 0) ; 14 | } 15 | 16 | void main() {} 17 | -------------------------------------------------------------------------------- /tests/types/variant3_types.c: -------------------------------------------------------------------------------- 1 | type nat = int with self >= 0 2 | 3 | type Lisp_object_union = union { 4 | Lisp_Cons+ with (a = 3) list ; 5 | int with (a != 3) other ; 6 | } 7 | 8 | type Lisp_Object = ∃ a : (nat with (self < 8)). ∃ p : Lisp_object_union(a) with (self & 7 = 0) . int with (self = p | a) 9 | 10 | type Lisp_Cons = struct { 11 | Lisp_Object car; 12 | union { 13 | Lisp_Object cdr; 14 | Lisp_Cons? chain; 15 | } u; 16 | } 17 | 18 | void test(List_Object ptr); 19 | -------------------------------------------------------------------------------- /tests/types/variant_ptr.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | typedef union expr { 5 | int constant ; 6 | struct { int a ; int b ; } sum ; 7 | } expr ; 8 | 9 | typedef struct pair { 10 | int a ; 11 | int b ; 12 | } pair ; 13 | 14 | void test(int ptr) { 15 | if (((ptr << 29) >> 29) == 1) { 16 | expr * e = (expr*) ((ptr >> 3) << 3) ; 17 | __VERIFIER_assert((*e).constant < 1000) ; 18 | } 19 | else { 20 | expr * e = (expr*) ((ptr >> 3) << 3) ; 21 | int a = (*e).sum.a ; 22 | int b = (*e).sum.b ; 23 | expr * e1 = (expr*) ((a >> 3) << 3) ; 24 | expr * e2 = (expr*) ((b >> 3) << 3) ; 25 | //__VERIFIER_assert (a->tag >= 0) ; 26 | //__VERIFIER_assert (b->tag >= 0) ; 27 | __VERIFIER_assert (0 < e1) ; 28 | __VERIFIER_assert (0 < e2) ; 29 | } 30 | } 31 | 32 | int main(void) { 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /tests/types/variant_ptr_types.c: -------------------------------------------------------------------------------- 1 | type nat = int with self >= 0 2 | 3 | type expr_ptr = ∃ a : (nat with (self < 3)). ∃ p : expr_ts(a) with ((self & 7) == 0) . (int with (self == (p | a))) 4 | 5 | type expr_ts = union { 6 | (struct { int with self < 1000 val ; int with self = 0 padding ; }) with (a == 1) constant ; 7 | (struct { expr_ptr a ; expr_ptr b ; }) with (a != 1) sum ; 8 | }+ 9 | 10 | void test(expr_ptr ptr); 11 | -------------------------------------------------------------------------------- /tests/types/variant_types.c: -------------------------------------------------------------------------------- 1 | type nat = int with self >= 0 2 | 3 | type expr = ∃ a : (nat with self < 2) . (expr_t(a)+) 4 | 5 | type expr_t = struct { 6 | int with (self = a) tag ; 7 | union { 8 | (struct { int with self < 1000 val ; int with self = 0 padding ; }) with (a = 0) constant ; 9 | (struct { expr a ; expr b ; }) with (a != 0) sum ; 10 | } data ; 11 | } 12 | 13 | void test(expr e); 14 | 15 | -------------------------------------------------------------------------------- /tests/types/variant_types2.c: -------------------------------------------------------------------------------- 1 | type expr = ∃ a : (nat with self < 2) . (struct { 2 | int with (self = a) tag ; 3 | union { 4 | (int with (self = 100)) with (a = 0) a ; 5 | (int with (self = 200)) with (a != 0) b ; 6 | } data ; 7 | })+ 8 | 9 | void test(expr e); 10 | 11 | -------------------------------------------------------------------------------- /tests/types/variant_types3.c: -------------------------------------------------------------------------------- 1 | type bad_expr = struct { 2 | int tag ; 3 | int with (self = 100) data ; 4 | }+ 5 | 6 | void test(bad_expr e); 7 | -------------------------------------------------------------------------------- /tests/types/vector.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | void test(int * vect) { 4 | int length = (*vect) ; 5 | vect++; 6 | for (int i = 0; i < length; i++) { 7 | //__VERIFIER_assert (vect + i == ptr) ; 8 | *(vect + i) = 47 ; 9 | } 10 | //__VERIFIER_flush_cache() ; 11 | } 12 | 13 | void main() {} 14 | 15 | -------------------------------------------------------------------------------- /tests/types/vector47_types.c: -------------------------------------------------------------------------------- 1 | type pos = int with self > 0 2 | 3 | type vector = ∃ sz : pos. (struct { 4 | (int with self = sz) length ; 5 | (int with self = 47)[sz] content ; 6 | }+) 7 | 8 | void test(vector+ v); 9 | -------------------------------------------------------------------------------- /tests/types/vector_test_vector_types.cdump: -------------------------------------------------------------------------------- 1 | vector.c:4.15-20: `*vect' -> [3..0x7FFFFFFF] 2 | vector.c:4.16-20: `vect' -> ([1..0xFFFFFFFF] : ({self : Name(vector)[{0}].(0)* | (self != 0)})) 3 | vector.c:5.1-7: `vect + 1' -> ([1..0xFFFFFFFF] : ({self : Name(vector)[{0}].(0)* | (self != 0)})) + 0x4 4 | vector.c:5.1-5: `vect' -> ([1..0xFFFFFFFF] : ({self : Name(vector)[{0}].(0)* | (self != 0)})) 5 | vector.c:6.17-27: `i < length' -> {0; 1} 6 | vector.c:6.17-18: `i' -> [0..0x7FFFFFFF] 7 | vector.c:6.21-27: `length' -> [3..0x7FFFFFFF] 8 | vector.c:8.4-12: `vect + i' -> ([5..0xFFFFFFFF] : 9 | ({self : Name(vector)[{0}].(4)* | (self != 0)} + [0..0x7FFFFFFC],0%4)) 10 | vector.c:8.4-8: `vect' -> ([5..0xFFFFFFFF] : ({self : Name(vector)[{0}].(4)* | (self != 0)})) 11 | vector.c:8.11-12: `i' -> [0..0x7FFFFFFE] 12 | vector.c:6.29-32: `i + 1' -> [1..0x7FFFFFFF] 13 | vector.c:6.29-30: `i' -> [0..0x7FFFFFFE] 14 | Unproved regular alarms: 15 | Unproved additional alarms: 16 | + vector.c:8 : { *(vect + i) = 47; } -> store_param_nonptr ; 17 | Proved 2/2 regular alarms 18 | Unproved 0 regular alarms and 1 additional alarms. 19 | Solved 0/0 user assertions, proved 0 20 | -------------------------------------------------------------------------------- /tests/types/vector_types.c: -------------------------------------------------------------------------------- 1 | type vector = ∃ a : (int with self > 2) . struct { 2 | (int with self = a) length ; 3 | char[a]+ content ; 4 | } 5 | 6 | void test(vector+ v); 7 | -------------------------------------------------------------------------------- /tests/types/vector_types2.c: -------------------------------------------------------------------------------- 1 | type pos = int with self > 0 2 | 3 | type vector = ∃ sz : pos. (struct { 4 | (int with self = sz) length ; 5 | (int with self = 47)[sz] content ; 6 | }+) 7 | 8 | void test(vector+ v); 9 | -------------------------------------------------------------------------------- /tests/types/wrong.c: -------------------------------------------------------------------------------- 1 | #include "binsec-stubs.h" 2 | 3 | struct pair { 4 | int a ; 5 | int b ; 6 | } 7 | 8 | void test1(pair * ptr) { 9 | __VERIFIER_assert (ptr->a == ptr->b) ; 10 | } 11 | 12 | // /!\ p = pair? not pair+ 13 | void test2(pair * ptr) { 14 | pair p = ptr* ; 15 | if (ptr + 4 > 0) { 16 | int b = ptr->b ; 17 | __VERIFIER_assert (ptr->a == b) ; 18 | } 19 | } 20 | 21 | void test3 () { 22 | int i; 23 | int* value = &i; 24 | __VERIFIER_assert(value == 0) ; 25 | } 26 | 27 | int main() { 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /tests/types/wrong_types.c: -------------------------------------------------------------------------------- 1 | type paireq = ∃ a:int. struct { 2 | (int with self = a) x; 3 | (int with self = a) y; 4 | } 5 | 6 | void test1(paireq+ p); 7 | 8 | void test2(paireq+ p); 9 | 10 | void test3(); 11 | -------------------------------------------------------------------------------- /tests/unit/corrected/bench.alarms.expected: -------------------------------------------------------------------------------- 1 | test1-O0: 1 2 | test1-O0: 1 3 | test2-O0: 1 4 | test3-O0: 1 5 | -------------------------------------------------------------------------------- /tests/unit/corrected/binsec-stubs.h: -------------------------------------------------------------------------------- 1 | #ifndef BINSEC_STUBS_H 2 | #define BINSEC_STUBS_H 3 | 4 | #include /* For FILE and fprintf */ 5 | 6 | #ifndef NULL 7 | #define NULL 0 8 | #endif 9 | typedef unsigned int size_t; 10 | typedef enum { 11 | false = 0, 12 | true = 1 13 | } bool; 14 | 15 | int __VERIFIER_nondet_int(void); 16 | 17 | int *malloc_int(void); 18 | void *malloc_uf_node(void); 19 | void *malloc_T(void); 20 | void *malloc_elist(size_t); 21 | void *malloc_bstree(void); 22 | void *malloc__gdsl_node(void); 23 | void *malloc__gdsl_list(void); 24 | void *malloc__gdsl_list_cursor(void); 25 | void *malloc__gdsl_bintree(void); 26 | void *malloc_gdsl_bstree(void); 27 | void *malloc_jsw_avlnode(void); 28 | void *malloc_jsw_avltree(void); 29 | void *malloc_jsw_avltrav(void); 30 | void *malloc_rbnode(void); 31 | void *malloc_rbtree(void); 32 | void *malloc_snode(void); 33 | void *malloc_stree(void); 34 | void *malloc_edge(void); 35 | void *malloc_node(void); 36 | void free(void *); 37 | 38 | void assert(bool); 39 | 40 | /* To prevent the compiler from foregoing unused variables. */ 41 | void use(void *p); 42 | 43 | /* We redeclare malloc with an incompatible type to avoid using it by accident 44 | * in the source */ 45 | void malloc(void); 46 | 47 | /* To analyze MemCAD benchmarks without removing all _memcad directives. This 48 | * does nothing. */ 49 | void _memcad(char*); 50 | 51 | /** Extensions */ 52 | 53 | void __VERIFIER_assert(bool); 54 | 55 | void __VERIFIER_flush_cache(void); 56 | 57 | void __VERIFIER_debug_int32(int); 58 | 59 | #endif /* BINSEC_STUBS_H */ 60 | 61 | -------------------------------------------------------------------------------- /tests/unit/corrected/rb_tree_after_cpp.c: -------------------------------------------------------------------------------- 1 | #include "binsec-stubs.h" 2 | 3 | struct a { 4 | struct a *b; 5 | struct a *c 6 | } f, *g; 7 | 8 | struct d { 9 | struct a *e 10 | } 11 | 12 | main() {} 13 | 14 | main_insert(struct d *h, __attribute__(()) j) { 15 | struct d i = *h; 16 | struct a *a = j; 17 | f = *i.e; 18 | g = f.b; 19 | a->c = NULL; 20 | if (f.b) 21 | g->b = j; 22 | } 23 | -------------------------------------------------------------------------------- /tests/unit/corrected/rb_tree_after_cpp2.c: -------------------------------------------------------------------------------- 1 | struct rbnode { 2 | struct rbnode *left; 3 | struct rbnode *right; 4 | } *root, *n; 5 | 6 | struct rbtree { 7 | struct rbnode *root 8 | } 9 | 10 | main() {} 11 | 12 | main_insert(struct rbtree *tree, struct rbnode *node) { 13 | root = tree->root; 14 | n = node->right; 15 | node->right = root->left ; 16 | if (root->left) 17 | n->left = node; 18 | } 19 | -------------------------------------------------------------------------------- /tests/unit/corrected/rb_tree_after_cpp3.c: -------------------------------------------------------------------------------- 1 | struct rbnode { 2 | struct rbnode *left; 3 | struct rbnode *right; 4 | } *root, *n; 5 | 6 | struct rbtree { 7 | struct rbnode *root 8 | } 9 | 10 | main() {} 11 | 12 | main_insert(struct rbtree *tree, struct rbnode *node) { 13 | root = tree->root; 14 | n = node->right; 15 | if (root->left > 0) { 16 | node->right = root->left ; 17 | } 18 | __VERIFIER_flush_cache () ; 19 | } 20 | -------------------------------------------------------------------------------- /tests/unit/corrected/types.c: -------------------------------------------------------------------------------- 1 | type rbnode = struct { 2 | rbnode? rbe_left; 3 | rbnode+ rbe_right; 4 | rbnode+ rbe_parent; 5 | int rbe_color; 6 | int i; 7 | } 8 | 9 | type rbtree = struct { 10 | rbnode+ rbh_root; 11 | } 12 | -------------------------------------------------------------------------------- /tests/unit/invalid/bad-load.c: -------------------------------------------------------------------------------- 1 | #include "binsec-stubs.h" 2 | 3 | struct pair { 4 | int a; 5 | int b; 6 | } 7 | 8 | test1(struct pair *p) { 9 | int a = p->b ; 10 | __VERIFIER_flush_cache () ; 11 | } 12 | 13 | test2(struct pair *p) { 14 | struct pair a = *p ; 15 | __VERIFIER_flush_cache () ; 16 | } 17 | 18 | main() {} 19 | -------------------------------------------------------------------------------- /tests/unit/invalid/bench.alarms: -------------------------------------------------------------------------------- 1 | test1-O0: 0 2 | test1-O0: 0 3 | test2-O0: -------------------------------------------------------------------------------- /tests/unit/invalid/bench.alarms.expected: -------------------------------------------------------------------------------- 1 | test1-O0: 0 2 | test1-O0: 0 3 | test2-O0: 4 | -------------------------------------------------------------------------------- /tests/unit/invalid/binsec-stubs.h: -------------------------------------------------------------------------------- 1 | #ifndef BINSEC_STUBS_H 2 | #define BINSEC_STUBS_H 3 | 4 | #include /* For FILE and fprintf */ 5 | 6 | #ifndef NULL 7 | #define NULL 0 8 | #endif 9 | typedef unsigned int size_t; 10 | typedef enum { 11 | false = 0, 12 | true = 1 13 | } bool; 14 | 15 | int __VERIFIER_nondet_int(void); 16 | 17 | int *malloc_int(void); 18 | void *malloc_uf_node(void); 19 | void *malloc_T(void); 20 | void *malloc_elist(size_t); 21 | void *malloc_bstree(void); 22 | void *malloc__gdsl_node(void); 23 | void *malloc__gdsl_list(void); 24 | void *malloc__gdsl_list_cursor(void); 25 | void *malloc__gdsl_bintree(void); 26 | void *malloc_gdsl_bstree(void); 27 | void *malloc_jsw_avlnode(void); 28 | void *malloc_jsw_avltree(void); 29 | void *malloc_jsw_avltrav(void); 30 | void *malloc_rbnode(void); 31 | void *malloc_rbtree(void); 32 | void *malloc_snode(void); 33 | void *malloc_stree(void); 34 | void *malloc_edge(void); 35 | void *malloc_node(void); 36 | void free(void *); 37 | 38 | void assert(bool); 39 | 40 | /* To prevent the compiler from foregoing unused variables. */ 41 | void use(void *p); 42 | 43 | /* We redeclare malloc with an incompatible type to avoid using it by accident 44 | * in the source */ 45 | void malloc(void); 46 | 47 | /* To analyze MemCAD benchmarks without removing all _memcad directives. This 48 | * does nothing. */ 49 | void _memcad(char*); 50 | 51 | /** Extensions */ 52 | 53 | void __VERIFIER_assert(bool); 54 | 55 | void __VERIFIER_flush_cache(void); 56 | 57 | void __VERIFIER_debug_int32(int); 58 | 59 | #endif /* BINSEC_STUBS_H */ 60 | 61 | -------------------------------------------------------------------------------- /tests/unit/invalid/types.c: -------------------------------------------------------------------------------- 1 | type pair = struct { 2 | int a; 3 | int b; 4 | } 5 | -------------------------------------------------------------------------------- /types/test.types: -------------------------------------------------------------------------------- 1 | /* Testing a comment. */ 2 | /* A more difficult one **/ 3 | 4 | // Should still print a 5 | type a = int 6 | type b = int+ 7 | type c = struct { int i; /* comment */ int j; } 8 | type d = union { int i; struct { int i;}+ n; } 9 | type e = int with self = 3 10 | 11 | 12 | int func(void); 13 | int func(); 14 | int func(int i); 15 | int func(int i, int j); 16 | inline struct bar* func(int a, int b); 17 | 18 | struct foo { 19 | int i; 20 | int j; 21 | }; 22 | 23 | union bar { int a; short b; }; 24 | 25 | void test2 (([int] -> void)+ funptr); 26 | 27 | 28 | 29 | 30 | // Expressions. 31 | type e1 = int with self == 4 + 3 32 | type e2 = int with self + 1 == 4 33 | type e3 = int with self + 1 * 5 == 4 34 | type e3 = int with self * 1 + 2 * 5 == 4 35 | type e4 = int with self * 5 + 2 == 4 36 | type e5 = int with self * 5 * 6 == 4 37 | type e6 = int with self + 5 - 6 == 4 38 | type e7 = int with (self << 5) == 4 39 | type e8 = int with self == (4 >> 2) 40 | type e9 = int with self <= 8 && self >= 2 41 | type e10 = int with self <= 8 && self >= 2 && self % 4 == 0 42 | type e11 = int with self <= 8 || self >= 2 || self % 4 == 0 43 | type e12 = int with (self & 3) == 4 44 | type e13 = int(+)(int,int) 45 | 46 | 47 | // Those fail as we cannot compare the precedence of operators. 48 | // type e = int with self << 5 == 4 49 | // type e = int with self < 3 < 5 50 | // type a = int with self + 2 + 3 = 4 << 8 51 | // type e10 = int with self <= 8 && self >= 2 || self % 4 == 0 52 | // type e12 = int with self & 3 == 4 53 | // type e13 = \exists n:int. int+ 54 | -------------------------------------------------------------------------------- /types/types.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* This file is part of the Codex semantics library. *) 3 | (* *) 4 | (* Copyright (C) 2013-2024 *) 5 | (* CEA (Commissariat à l'énergie atomique et aux énergies *) 6 | (* alternatives) *) 7 | (* *) 8 | (* you can redistribute it and/or modify it under the terms of the GNU *) 9 | (* Lesser General Public License as published by the Free Software *) 10 | (* Foundation, version 2.1. *) 11 | (* *) 12 | (* It is distributed in the hope that it will be useful, *) 13 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 14 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 15 | (* GNU Lesser General Public License for more details. *) 16 | (* *) 17 | (* See the GNU Lesser General Public License version 2.1 *) 18 | (* for more details (enclosed in the file LICENSE). *) 19 | (* *) 20 | (**************************************************************************) 21 | 22 | module Ctypes = Ctypes 23 | -------------------------------------------------------------------------------- /utils/not_implemented.ml: -------------------------------------------------------------------------------- 1 | (**************************************************************************) 2 | (* This file is part of the Codex semantics library. *) 3 | (* *) 4 | (* Copyright (C) 2013-2024 *) 5 | (* CEA (Commissariat à l'énergie atomique et aux énergies *) 6 | (* alternatives) *) 7 | (* *) 8 | (* you can redistribute it and/or modify it under the terms of the GNU *) 9 | (* Lesser General Public License as published by the Free Software *) 10 | (* Foundation, version 2.1. *) 11 | (* *) 12 | (* It is distributed in the hope that it will be useful, *) 13 | (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) 14 | (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) 15 | (* GNU Lesser General Public License for more details. *) 16 | (* *) 17 | (* See the GNU Lesser General Public License version 2.1 *) 18 | (* for more details (enclosed in the file LICENSE). *) 19 | (* *) 20 | (**************************************************************************) 21 | 22 | let not_implemented() = assert false;; 23 | --------------------------------------------------------------------------------